I am using WinPython with Python 3.3.2 under Windows 7. I like to be able to run python programs from the command prompt simply by typing the name of the program, like program.py
. This didn't work at first, requiring me to type python program.py
until I set the file associations under windows to associate .py files with python. Then it worked.
However, I just discovered that if I run a program by typing the program name, I can't see any of the command line arguments in sys.argv. For instance, program.py arg1
will not show arg1 in sys.argv. All I see is the first argument, the name of the program. BUT, if I run the program by typing python.exe program.py arg1
then I can arg1.
I need command-line args, but I don't want the extra typing because I'll be running commands many times. Any idea what's wrong?