How to run __main__ programs inside python-mode?
I'm probably missing something obvious, but what's the best way to use python-mode to run/debug python scripts that are designed to be run from the command line? In particular, the problem I face is that while __main__ is set fine, if my code tries to access sys.argv, it gets information that is not very useful, e.g.,
In [5]: sys.argv
Out[5]: ['/Library/
I could always write a main() function, set up my own argument list, and then call main(myargs), or something similar, but this isn't so convenient when all I want to do is run someone else's sample code.
How do others deal with this? Is there a facility in python-mode (or should there be) to pass a user-defined sys.argv to scripts run by pressing C-c C-c?
Question information
- Language:
- English Edit question
- Status:
- Expired
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: