2 Mar 2012 19:34
Fwd: [Question #189464]: How to run __main__ programs inside python-mode?
Andreas Röhler <andreas.roehler <at> online.de>
2012-03-02 18:34:09 GMT
2012-03-02 18:34:09 GMT
New question #189464 on python-mode.el: https://answers.launchpad.net/python-mode/+question/189464 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/Frameworks/EPD64.framework/Versions/7.2/bin/ipython', '-i'] 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?
RSS Feed