On Fri, Jul 23, 2010 at 2:25 AM, Alexander Belopolsky
<alexander.belopol...@gmail.com> wrote:
> Note also that argparse/optparse does not know about -m way either:
>
> $ python -m profile -h
> Usage: profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...
>
> I am not sure if it is possible for argparse to distinguish between -m
> and file name invocations, so maybe it should always use python -m
> modname if sys.argv[0] ends with .py.  Again, this is quite important
> if the module being run is inside a package.

If __main__.__package__ is set to anything other than None, odds are
fairly good that runpy did the import. If it's set to a non-empty
string, you definitely *shouldn't* be invoking the relevant main
script by filename.

Sounds like one for the tracker.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to