Command line arguments not being passed to script when using py.exe as the default way to run .py scripts

Issue #22 invalid
Bart van Nierop
created an issue

Like the title describes, command line arguments do not appear to be passed to a python script when executed using C:\Windows\py.exe as the default program for .py files.

To illustrate this, I wrote a very simple script. Lets call it

  import sys

  print sys.argv
  print sys.executable

Executing this script as

  C:\tmp> -foo -bar -baz

Results in the output


Running it as

  C:\tmp> py -foo -bar -baz

Gets the expected result:

  ['', '-foo', '-bar', '-baz']

Changing the default program to C:\Python27\python.exe and running the script as

  C:\tmp> -foo -bar -baz

Results in the expected output:

  ['C:\\tmp\\', '-foo', '-bar', '-baz']

Comments (5)

  1. Bart van Nierop reporter

    I have not been able to reproduce this at work, earlier today. Yet, on my system at home:

    [Edit] I should note that right before this I uninstalled and then installed pylauncher using a freshly downloaded msi.

  2. Vinay Sajip

    It looks as if your registry on your home machine might be hosed. Uninstall the launcher, ensure that there are no registry entries relating to .py or Python.File and similar (deleting them manually if necessary), then reinstall the latest launcher and try again.

    I'd be surprised if it's a real bug, since no one else has reported it and quite a few people use the launcher all the time; someone would surely have noticed.

  3. Log in to comment