[issue2972] arguments and default path not set in site.py and sitecustomize.py
Geoffrey Bache gjb1...@users.sourceforge.net added the comment: Thanks for the tips, looks like we have the basis for a solid workaround here. Perhaps that could be encapsulated and added as sys.raw_argv or something in future? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Tim Golden m...@timgolden.me.uk added the comment: Suggest you raise a separate feature-request issue for that, Geoff, perhaps offering the two implementations described. Perhaps raise it it on python-ideas first to gauge reactions. I'm +0 myself since it's so easy to do anyway and I don't know how common a requirement it would be. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Matthew Woodcraft matt...@woodcraft.me.uk added the comment: open(/proc/self/cmdline).read() should work on linux (note that the arguments are separated by NULs). -- nosy: +mattheww ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Geoffrey Bache gjb1...@users.sourceforge.net added the comment: I also just ran into this. Is it likely that an enhancement request to provide access to the raw command line, as requested by the previous commenter, would be accepted? It's sometimes useful to have some idea about what kind of Python process is being started at this point. -- nosy: +gjb1002 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Tim Golden m...@timgolden.me.uk added the comment: Merely from a Windows point-of-view, you could get the full command line fairly easily: code import ctypes pstring = ctypes.windll.kernel32.GetCommandLineW () print (ctypes.c_wchar_p (pstring).value) /code TJG -- nosy: +tim.golden ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Geoffrey Bache gjb1...@users.sourceforge.net added the comment: Interesting. Any idea if something similar is possible on Linux? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Tim Golden m...@timgolden.me.uk added the comment: I'm afraid I don't know; might be worth asking that on the main python mailing list. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Hari Krishna Dara harid...@gmail.com added the comment: I hit exactly this same problem today trying to customize sys.path. We conventionally use .pth file under site-packages to add our custom library paths, but this is not convenient in development while switching between branches/checkout directories, so I would like something like this to work: def updateADPath(dir): Determine the root of the AD code given the specific sub directory and update sys.path. Returns 0 on success. pass # First try the current directory. If not found, try the main script's directory. if updateADPath(os.getcwd()): # If not absolute path, the script is in the current dir anyway, which we have already tried. if len(sys.argv) 0 and sys.argv[0] != '-c' and os.path.isabs(sys.argv[0]): updateADPath(os.path.split(sys.argv[0])[0]) It works quite well as long as I run when the CWD is with in the branch directory, but if it is outside (such as when running from a windows shortcut) there is no way to determine the root. Is there an alternative means to access the raw command-line arguments, it would help me provide a partial workaround for this problem. -- nosy: +haridsv ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Brett Cannon br...@python.org added the comment: This cannot change as sys.argv needs to be set after Python initializes to strip out what arguments were meant for the interpreter and not the script being run. All of this also needs to happen with site executing first, so this cannot be changed. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Changes by Brett Cannon br...@python.org: -- priority: - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2972] arguments and default path not set in site.py and sitecustomize.py
Changes by Daniel Diniz aja...@gmail.com: -- assignee: - brett.cannon nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com