Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Pythonista debugger
-
Could someone point me to documentation that explains how to use the Pythonista debugger, including the built-in breakpoint feature? Thanks!
-
The Debugger section of http://omz-software.com/pythonista/docs/ios/new.html is all the docs I have seen.
-
Thanks for the info - I hadn’t seen that.
It seems I was trying to use it correctly, but I was setting a breakpoint in a custom view’s update method, and the debugger seems to ignore it. Is there something under the hood here that prevents the debugger from accessing this code?
-
I don't think you can set a breakpoint inside a view callback, unless maybe if you wrap the callback in ui.in_background, though even then, since that code is called by a different thread, I'm not sure the main interpreter knows about it. I think once the main script "ends", the breakpoints don't do anything (like, if you call a function from the console, breakpoint do nothing)
You may be able to import the pythonista debugger module (I forget the name... It is a subclass of bdb), then call set_trace from within your code. Also, I suspect if, from your main script, you call your callback yourself, then the breakpoint would work.
The best way to debug view code, in my opinion is to run your view in 'panel' so you can switch back and forth between console and the view. You can also use pdb.set_trace to run pdb using the console in this way, but just make sure your callbacks are in the background in the case.
-
Thank you!