Skip to content

Launching .py file on Windows does not pass on parameters, and opens new terminal #247

@hr-sbu

Description

@hr-sbu

Install source and version

  • Installed from the Windows Store
  • Installed with the MSIX from python.org
  • Installed with the MSI from python.org
  • Installed with winget install 9NQ7512CXL7T

Version: 25.2

Description: Calling Python scripts from the command line (e.g. cmd) won't pass parameters to the script.

To Reproduce

testme.py:

import sys
print(sys.argv)
input()
  1. Create testme.py (see above)
  2. open cmd
  3. type testme.py testparam

A new console opens (why???) and shows ['...\\testme.py'], but not the parameter.

Expected output
The "classic" launcher and Python 3.13 on Windows behaved differently, neither was a new console window opened, nor were parameters missing.

Expected would be the following picture:

C:\Users\Myusername\Desktop>testme.py test
['C:\\Users\\Myusername\\Desktop\\testme.py', 'test']

C:\Users\Myusername\Desktop>

Expectation is:

  • stay in the same console window (as all output from the script is lost otherwise, making all (my) scripts for administration and orchestration of stuff on command line useless)
  • pass on all parameters to the script

Additional context

  • using py testme.py test shows the correct output, but (as described in the new launcher's docs and PEP 773) what are the file associations then good for, if most of my script's won't work that way, I wonder.
  • using testme.py test as target of a Windows shortcut (.lnk file) won't pass the parameter either, which is probably just plain wrong (e.g. when using a Shortcut to launch a .pyw with parameters, I cannot imagine it's wanted behaviour to remove all parameters)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions