Page 1 of 1
RenPy game with Python Debugger Attached
Posted: Sun Feb 26, 2017 3:17 pm
by Regis
Is the a "right way" to launch RenPy game with attached Python level debugger (like pdb or, better, PyCharm from JetBrains)?
How to launch RenPy-based game as Python script if I'm on Windows?
Any attempt to launch *.py file from game root results in
"""
Could not import pygame_sdl2. Please ensure that this program has been built
and unpacked properly. Also, make sure that the directories containing
this program do not contain : or ; in their names.
You may be using a system install of python. Please run GameName.sh,
GameName.exe, or GameName.app instead
"""
Re: RenPy game with Python Debugger Attached
Posted: Sun Feb 26, 2017 3:25 pm
by PyTom
In general, no. You'd have to somehow integrate the python debugger with the Ren'Py event loop. I don't know anyone who has done this.
Re: RenPy game with Python Debugger Attached
Posted: Sun Feb 26, 2017 3:34 pm
by Regis
I assumed that RenPy itself mainly work on Python. Am I wrong?
Could you please point to a place in RenPy sources where the Python execution starts?
Re: RenPy game with Python Debugger Attached
Posted: Sun Feb 26, 2017 3:37 pm
by Regis
Is the any docs that describe RenPy internal structure?
Re: RenPy game with Python Debugger Attached
Posted: Mon Feb 27, 2017 3:01 am
by PyTom
Ren'Py is written in a mix of Python, Cython, and C. Execution starts at the start of renpy.py. There isn't any documentation that describes Ren'Py's internal structures. The various files themselves are pretty well documented (at least for code touched in the past 5 years or so), but there isn't really a high-level overview document at this time. I don't get paid to work on Ren'Py, so documenting the internals is hard to get time for.
BTW, note that there is a Ren'Py console that you can get at by hitting shift+O. In the latest prerelease, it can be run when an exception occurs. That might get you some of the way to what you want.
Re: RenPy game with Python Debugger Attached
Posted: Mon Feb 27, 2017 3:29 pm
by Apa
PyTom wrote:In the latest prerelease, it can be run when an exception occurs. That might get you some of the way to what you want.
Cool! Almost like JIT debugger!

Re: RenPy game with Python Debugger Attached
Posted: Tue Feb 28, 2017 12:47 am
by ISAWHIM
PyTom wrote:I don't get paid to work on Ren'Py, so documenting the internals is hard to get time for.
Time for you to get a Patreon page and start getting paid. This program qualifies for acceptance there. Take advantage of this "burst wave" of money influx and ride the coat-tails of Patreon, until the next new thing comes around.
You not only help by making this possible, but also by directly assisting those of us in great need.
Just wanted to add, for those hitting this thread, the link to the dev-tools help page.
https://www.renpy.org/doc/html/developer_tools.html
I think that should be the first thing everyone can see on any code-help page, as well as the error-page that RenPy displays, when the game crashes.

Re: RenPy game with Python Debugger Attached
Posted: Tue Feb 28, 2017 4:39 pm
by Regis
PyTom, how to actually import "pygame_sdl2" from Python code?
Note: I want to import version that is distributed with the game and/or RenPy SDK. Naive approach when I just use embedded Python doesn't work

Re: RenPy game with Python Debugger Attached
Posted: Tue Feb 28, 2017 5:28 pm
by PyTom
Re: RenPy game with Python Debugger Attached
Posted: Tue Feb 28, 2017 6:19 pm
by gas
ISAWHIM wrote:PyTom wrote:I don't get paid to work on Ren'Py, so documenting the internals is hard to get time for.
Time for you to get a Patreon page and start getting paid. This program qualifies for acceptance there. Take advantage of this "burst wave" of money influx and ride the coat-tails of Patreon, until the next new thing comes around.
Patreon put a number of issues.
One, the project is not entirely a PyTom thing and a number of people contributed from the start (a LARGE number). If PyTom get money, translators, interface designers and other contributors want their slice of the cake.
Two, you really want to work with an engine that could cease to exist or being updated if
someone else stop to pledge it?
Third, documenting things is not forbidden for the community. Is a large and boring task, but you can do it at will. I think that PyTom can't and couldn't exchange his regular work hours with "who knows" pledges to do a secondary thing (99.9% of people are not even going over the quick start guide, that's all they need to do a visual novel).
so if someone want, is the welcome and the community will be grateful.
To get money, I think is far better to do low level core changes for companies that ACTUALLY can pay real money for ("Take this 2000 dollars and code a way to avoid rpa extractor work on the scripts.."). Or selling accessories, like the Interactive Director.
Re: RenPy game with Python Debugger Attached
Posted: Wed Mar 01, 2017 2:05 am
by PyTom
I'm considering running a Patreon at some point. While Ren'Py has quite a few contributors, it will remain open source. I suspect each contributor would be able to run their own patreon, although there are some issues with the Ren'Py trademark that I own. (I'd be fine if a regular contributor ran a patreon to contribute more, but not someone random trying to trade on the name.) Ren'Py would continue existing regardless, but it would be nice to work on it more, and afford some tools I'd like, such as a visual studio subscription.
Re: RenPy game with Python Debugger Attached
Posted: Thu Mar 02, 2017 4:04 pm
by Regis
Doesn't work when I try to run
```
import pygame_sdl2
```
directly from Python executable that is distributed with game. Do I need to specify additional search path? Do I need to manually load sdl2.dll somehow?
Re: RenPy game with Python Debugger Attached
Posted: Thu Mar 02, 2017 4:40 pm
by PyTom
Run python with the -O option.
Re: RenPy game with Python Debugger Attached
Posted: Tue Aug 22, 2017 4:45 am
by Enerccio
Any info on better debugging? If you have lots of normal python code, sometimes it is better to debug it outside the renpy which makes no sense...