argv[0] manipulation
Mike Meyer
mwm at mired.org
Wed Dec 11 08:17:10 EST 2002
More information about the Python-list mailing list
Wed Dec 11 08:17:10 EST 2002
- Previous message (by thread): argv[0] manipulation
- Next message (by thread): argv[0] manipulation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
P_spam_ at draigBrady.com writes: > Hi, > > I had the idea to select debugging mode > in my application depending on the contents of argv[0]. > The logic was: > > if '/' in argv[0]: #explicit path so debug > debugging = 1 > else: > debugging = 0 > > However this fails in the case where you > invoke a script in the current directory > with the python interpreter explicitly. > So shouldn't python change argv[0] to > './myscript' instead of 'myscript' in this case: > > python myscript > > Usually the current directory is not in the > $PATH for security reasons, so an argv of > './myscript' is the equivalent of (what you > would need to type to run the script) python myscript. Well, it could make other people's handling of arguments more painfull and/or ugly, depending. Is there some reason you don't want to keep your curernt arrangement and just type "python ./myscript" to get debugging, and "python myscript" to get it without debugging? <mike -- Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
- Previous message (by thread): argv[0] manipulation
- Next message (by thread): argv[0] manipulation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list