Retrieving the full command line

Tim Golden mail at
Wed Jan 23 10:58:02 CET 2013

On 23/01/2013 03:58, Steven D'Aprano wrote:
> Currently, if I have a package that prints sys.argv, I get 
> results like this:
> steve at runes:~$ python3.3 /home/steve/python/testpackage/ ham 
> spam eggs
> ['/home/steve/python/testpackage/', 'ham', 'spam', 'eggs']
> which is correct, that's what I gave on the command line. But:
> steve at runes:~$ python3.3 -m testpackage ham spam eggs
> ['/home/steve/python/testpackage/', '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:

so I'll probably go and contribute over there.


More information about the Python-list mailing list