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.
sys.argv when using the debugger
-
Is it possible to debug a program that requires command line arguments via sys.argv? This behaves differently when launched via Run vs Debug (after setting a breakpoint) and the command line arguments, when specified, are lost.
Import sys Print(sys.argv)
-
I count this as a bug -- the debugger says the main script is pythonista_debugger with your script as the args, rather than honoring your args.
A workaround is to use run instead of debug: set your first breakpoint (either at prigram start, or where you know you want to poke around) using
import debugger debugger.set_trace()
At that point breakpoints work normally.
-
Thanks for sharing this JonB. This technique looks handy. I will give this a try.