python - sys.argv not working on sytems with previous .py associations -
bit of background. work vfx studio , have in past had alter .py files other programs using notepad or notepad++, no 1 ever used python.
so have been rolling out python automation scripts , they're working great, except 1 problem. machine had python scripts associated other python fail.
the script called argument:
myscript.py <argument> then use:
print sys.argv versionname = sys.argv[1] this works great on machines never had python files associated anything, machines had python associated application fail won't read argument , list index out or range error. print line shows not recieving input either.
any thoughts on how fix this?
edit: script returns when run:
z:\pythonscripts>make_version_1.py test ['z:\\pythonscripts\\make_version_1.py'] traceback (most recent call last): file "z:\pythonscripts\make_version_1.py", line 20, in <module> versionname = sys.argv[1] indexerror: list out of range this error not returned form majority of machines in office .. ones .py files had been associated program before python 2.7.6 installed, know code works.
you need tell windows want pass arguments python. open command prompt, , this:
assoc .py=pythonfile ftype pythonfile=python.exe %1 %*
Comments
Post a Comment