Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83132

Re: Command Line Inputs from Windows

References <COL130-DS1607D96864155F77FE9C11C85D0@phx.gbl>
Date 2015-01-03 08:29 +1100
Subject Re: Command Line Inputs from Windows
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.17334.1420234154.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Jan 3, 2015 at 6:44 AM, Ken Stewart <gordon_ken_stewart@msn.com> wrote:
> This works:
> python myScript.py arg1 arg2 arg3
>
> This doesn’t work:
> myScript.py arg1 arg2 arg3

The latter form is governed by the association. I don't know off-hand
where that's set in the registry, but you should be able to poke
around in folder settings to find it (but, thank you very much
Microsoft, the exact menu path has changed a number of times between
Win2K and Win8). On WinXP, if I have my test-box set up correctly,
it's View, Folder Options, File Types, select the one for .py,
Advanced, select "open", Edit. That'll tell you that the application
used is something like:

"C:\Python27\python.exe" "%1" %*

The %* should mean that arguments get carried through; if that's
missing, you won't get any args.

I may have some details wrong, and it's likely to be a little
different on Win7, but poke around and look for a missing %*. Or,
better still, make sure you have the py.exe launcher; then you can
have Python scripts request a specific interpreter using a PEP 397
compliant shebang, which will also work nicely on Unix systems.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Command Line Inputs from Windows Chris Angelico <rosuav@gmail.com> - 2015-01-03 08:29 +1100

csiph-web