This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sys.argv only works with python exe
Type: Stage:
Components: Windows Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: theller Nosy List: thehaas, theller
Priority: normal Keywords:

Created on 2002-04-04 16:38 by thehaas, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (4)
msg10160 - (view) Author: Mike Hostetler (thehaas) Date: 2002-04-04 16:38
This is a weird one, and I've know it works on other
Win2000 installations, but it doesn't work on mine.

sys.argv only works when I put "python" in front of it
in the cmd command line.  However, the script does run
if I just type in it's name, but it ignores all command
line arguments.

Version: 2.2
Platform: Win2000

Example:

C:\stuff>type test.py
import sys
print sys.argv

C:\stuff>test.py arg1 arg2
['C:\\stuff\\test.py']

C:\stuff>python test.py arg1 arg2
['test.py', 'arg1', 'arg2']

Is this something with my setup, or something else??


msg10161 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-04-04 17:13
Logged In: YES 
user_id=11105

I can reproduce this behaviour if I change the association 
for Python files from the default entry
'C:\python22\python.exe "%1" %*'
into
'C:\python22\python.exe "%1"'.
You can find this entry from Windows Explorer,
Tools->Folder Options->File Types.
Select the 'PY Python File' entry, press advanced, select 
the 'open' entry, press edit, and look at the "Appplication 
used to perform action" entry.

Probably something wrong with your setup.
msg10162 - (view) Author: Mike Hostetler (thehaas) Date: 2002-04-04 17:26
Logged In: YES 
user_id=116274

I went into that, I had got the PY option, but instead it
sais "PY File".  And instead of an advanced button, it had
"Change", with the text beside it saying "Change to Default
'Python File""  I hit that button, which than turned to
"Advanced" and the PY option turned into "Python File". 
When I hit "Advanced" the option was 'C:\python22\python.exe
"%1" %*', it it now works from the command line:


C:\stuff>test.py arg1
['C:\\stuff\\test.py', 'arg1']

I'm not sure what caused it to change (perhaps Vim??) but it
works now.

Closing it myself.  Thanks for the help


msg10163 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-04-04 18:00
Logged In: YES 
user_id=11105

Fine. Assigning the bug to myself, and changing the 
resolution to 'works for me'.
History
Date User Action Args
2022-04-10 16:05:11adminsetgithub: 36380
2002-04-04 16:38:27thehaascreate