If you use python via the command line in Windows vista, you’ll notice that it won’t accept command line arguments if you run a script. For example this won’t work: python myscript.py argument1 argument2 Your python script won’t get the arguments. The fix for Windows Vista is:
- Get an application called: File Type Doctor
- Find the .py extension in the application
- Edit the Open action (add it if it doesn’t exist)
- Select the right python.exe file for "the application to carry out this action"
- put this in for the command line arguments (extactly as show, with the quotations): "%1" %*
{ 4 comments… read them below or add one }
Thanks, that worked great.
The problem I had was that it doesn’t pass the command line arguments if you don’t have “python” at the front.
So for example, this doesn’t work for me:
myscript.py argument1 argument2whereas this does:
python myscript.py argument1 argument2I don’t know if this is a related problem or not.
I had the same problem. After searching the entire registry I found the problem was with the following key:
[HKEY_CURRENT_USER\Software\Classes\Applications\python.exe\shell\open\command]
(default)=”D:\Python26\python.exe” “%1″
I changed it to:
(default)=”D:\Python26\python.exe” “%1″ %*
Python scripts now take arguments from the command line without ‘python’ at the beginning. That key was overriding the settings for Python.File.
Very frustrating, eh?
Nice, good catch.