By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

Command line arguments on Vista

P: n/a
So I write this sript called printargs.py:

------
#!/usr/local/bin/python
import sys
print 'there are %d args' % len(sys.argv)
for arg in sys.argv:
print 'arg: %s' % arg
------

and make it executable. On pretty much every platform I can get my
hands on, when I run

printargs.py booga -a wooga

I get this output:

there are 4 args
arg: printargs.py
arg: booga
arg: -a
arg: wooga

But on Windows Vista, when I run that command, I get

there are 1 args
arg: printargs.py

What's up with that?
--JMike

Jan 12 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
By the way, note that if I say (on Vista)

python printargs.py booga -a wooga

I get the desired output:
there are 4 args
arg: printargs.py
arg: booga
arg: -a
arg: wooga
So the quesiton still stands, what's up with that?

Thanks,
--JMike

Jan 12 '07 #2

P: n/a
Some further information: perl seems to do the same thing (losing
arguments).
We think it may have something to do with file association.

Any ideas anyone?
--JMike

Jan 12 '07 #3

P: n/a
jm***@alum.mit.edu wrote:
But on Windows Vista, when I run that command, I get

there are 1 args
arg: printargs.py

What's up with that?
It sounds like the registry entry for running Python files is messed up.
Can you go to a command line and see what the command 'ftype Python.File'
displays? (Assuming that command lines and ftype still work on Vista)

The output should be:
Python.File="C:\Python25\python.exe" "%1" %*

but if it only says:
Python.File="C:\Python25\python.exe" "%1"

then you would get the behaviour you observed (on any version of Windows,
not just Vista).
Jan 12 '07 #4

P: n/a
"Duncan Booth" <du**********@invalid.invalidescribió en el mensaje
news:Xn*************************@127.0.0.1...
It sounds like the registry entry for running Python files is messed up.
Can you go to a command line and see what the command 'ftype Python.File'
displays? (Assuming that command lines and ftype still work on Vista)

The output should be:
Python.File="C:\Python25\python.exe" "%1" %*

but if it only says:
Python.File="C:\Python25\python.exe" "%1"

then you would get the behaviour you observed (on any version of Windows,
not just Vista).
That would happen if the association was not made by the Python installer,
but by the user selecting Python.exe the first time he tried to execute a
Python script by double-clicking on it.

--
Gabriel Genellina

Jan 13 '07 #5

P: n/a
Thanks for the answers; that was the problem exactly.
--JMike

Duncan Booth wrote:
It sounds like the registry entry for running Python files is messed up.
Can you go to a command line and see what the command 'ftype Python.File'
displays? (Assuming that command lines and ftype still work on Vista)

The output should be:
Python.File="C:\Python25\python.exe" "%1" %*

but if it only says:
Python.File="C:\Python25\python.exe" "%1"

then you would get the behaviour you observed (on any version of Windows,
not just Vista).
Jan 16 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.