On 23/01/2013 03:58, Steven D'Aprano wrote: > Currently, if I have a package __main__.py that prints sys.argv, I get > results like this: > > steve@runes:~$ python3.3 /home/steve/python/testpackage/__main__.py ham > spam eggs > ['/home/steve/python/testpackage/__main__.py', 'ham', 'spam', 'eggs'] > > > which is correct, that's what I gave on the command line. But: > > steve@runes:~$ python3.3 -m testpackage ham spam eggs > ['/home/steve/python/testpackage/__main__.py', 'ham', 'spam', 'eggs'] > > > The second example is lying. It should say: > > ['-m testpackage', 'ham', 'spam', 'eggs']
Thanks for the input, Steven & Oscar. Apologies for the confusion over my initial example. Of course, -m runs something on sys.path, not something in the filesystem as such. I confused myself because, running on Windows where the current directory is on the path, I sit in c:\path\to and do python -mapp Now I look harder, this discussion is basically issue14208: http://bugs.python.org/issue14208 so I'll probably go and contribute over there. TJG -- http://mail.python.org/mailman/listinfo/python-list