omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    2
    3
    2371
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • robnee
      robnee last edited by

      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)
      
      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by JonB

        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.

        1 Reply Last reply Reply Quote 0
        • robnee
          robnee last edited by

          Thanks for sharing this JonB. This technique looks handy. I will give this a try.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors