Fix: Python Script Arguments Not Passed
G'day! Welcome to my blog. I only post intermittently. If you'd like to keep track of what I'm doing, please consider subscribing to my RSS feed. You can also follow me on Twitter (1-20 short posts a day) and Tumblr (a few found objects per month).
On Windows, you can run a Python script on the PATH simply with its name. These should be equivalent:
c:>congeal blood
c:>congeal.py blood
c:>python congeal.py blood
If it's not working that way, fixing PATHEXT and correcting the file type associations with ASSOC and FTYPE will usually do the trick:
c:>set PATHEXT=%PATHEXT%:.PY
c:>ftype Python.File="C:Python25python25.exe" "%1" %*
c:>assoc .py=Python.File
If that still isn't working, try deleting the following registry key:
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.PY
There's plenty of advice about PATHEXT, FTYPE, and ASSOC, but none of the search terms I tried dug up the registry key. I knew there had to be one, because giving FTYPE silly arguments didn't stop the script from being executed. I found the registry key by brute-force searching the registry for .PY. I'm posting this so that someone else can save that hour of hassle.