Command line arguments in Windows

Steve Holden steve at holdenweb.com
Tue Mar 4 06:51:25 EST 2008


Chris wrote:
> On Mar 4, 8:38 am, "Mike Walker" <mhwal... at shaw.ca> wrote:
>>> If you run a python file, ie. just double clicking it the only
>>> argument you will have will be the filename of the script.  If you
>>> create a shortcut to the script and in the target box add your
>>> arguments (if you have quotation marks place them after not inside)
>>> you will see your arguments.  fwiw you answered yourself in the third
>>> paragraph.
>> As I mentioned I am working from the command line, not clicking on the icon.
>> The only difference between it working and not is the python prefix, which
>> is why I was thinking this is some sort of file association problem.
>>
>> I probably wasn't as clear as I could have been in the third paragraph.
>>
>> argtest.py arg1 arg2 arg3 - Does not work only get sys.argv[0]
>> python argtest.py arg1 arg2 arg3 - Works
> 
> That seems rather wierd, just running argtest.py arg1 arg2 arg3 I get
> the correct output, Python 2.5.1 from python.org but running on XP
> though.  Potentially an issue with Vista... ?

Strange as it may seem, there have been issues with other Windows 
command processors, and one in particular (I can never remember which 
one) messes up IO redirection when the pathext mechanism is used to 
select the executable that processes the Python file.

So I would tend to suspect yet another variation on this familiar theme 
given your testing results. But I don't intend to tangle with Vaster any 
sooner than I must.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list