Python: Search for `sys.argv` before loading the` sys` module

I want to find the command line arguments with which my program was called, i.e. sys.argvbut I want to do this before Python makes it available sys.argv. This is because I run the code in usercustomize.py, which is imported by the module site, which is imported before Python fills sys.argv. (If you're interested, the reason I'm doing this is to start my debugger without changing the program code.)

Is there any way to find command line arguments without sys.argv?

Also: the solution should work for Python 2.6 :(

+6
source share

All Articles