The original command python line

Damjan Georgievski gdamjan at
Sun Mar 4 06:38:44 CET 2012

How can I get the *really* original command line that started my python

Werkzeug has a WSGI server which reloads itself when files are changed
on disk. It uses `args = [sys.executable] + sys.argv` to kind of
recreate the command line, and the uses to run that
command line.

BUT that's problematic as, when you run::

	python -m mypackage --config

sys.argv printed in mypackage/ will be::

	['/full/path/to/mypackage/', '--config']

so you get::

	python /full/path/to/mypackage/ --config

instead of::

	python -m mypackage --config

the difference in the 2 cases is what the current package is, and
whether you can use relative imports.


More information about the Python-list mailing list