idanshmu
idanshmu

Reputation: 5271

sys.argv is different depending on the method of invocation of script

I have a simple Python script that all it does is:

import sys
print sys.argv

When I open cmd and type

MyScript.py arg1

I get:

['C:\\MyScript.py']

But when type:

python MyScript.py arg1

I get:

['C:\\MyScript.py', 'arg1']

I've looked around here but did not find my answer.

I've uninstalled and re-installed Python 2.7.9 and it did not resolve it. Any idea?

Upvotes: 2

Views: 62

Answers (1)

igal k
igal k

Reputation: 1914

I actually had the same problem, i had to iterate through all python's occurrences over the registry and manually append the %* to the execution path

c:\...python "%1" to c:\...python "%1" %* 

Upvotes: 1

Related Questions