1

My application makes use of user creatable python scripts to interact with the application. I am using the python c API for this and therefore use the dlls. I neither use nor intend to deploy the python.exe itself to end users. To make things more difficult, I also want to call the scripts out off memory, not from a file.

How can I implement such debugging functionality? All I can find is

python -m pdb myscript.py

That means calling the exe (=other process), and saving the script to a file. Also, that unfortunately pops up another window.

There are some Py_* debugging methods in the API, but I do not know how to implement them correctly or if they are suitable for my use case at all.

Currently I think the way to go is starting a hidden debugger, attach somehow to the python system, and read/write back the communication to the application. Just that I have no starting point.

user2366975
  • 4,350
  • 9
  • 47
  • 87
  • I'm not sure if KDevelop implements this, but take a look at its Python plugin: https://cgit.kde.org/kdev-python.git/tree/ – arrowd May 21 '19 at 05:31
  • You might make your question a little more explicit about what you want to do. I’m imagining something like showing the user’s python source code in a window and single-stepping through its execution, setting breakpoints, showing the current values of various python variables, etc... is that what you have in mind? – Jeremy Friesner May 21 '19 at 05:33
  • Yes, stepping, breakpoints, etc is required. I would prefer to show the code inside a "code widget" inside my application. – user2366975 May 21 '19 at 05:53
  • Kdevelop starts an external process and uses the filesystem. Good see though. – user2366975 May 21 '19 at 06:28

0 Answers0