![]() |
.py as executable extension on windows
Hi,
is there a way to tell windows, that *.py files are executable, like ..bat, .js, ...? If I have someTool.py somewhere in my path I would like to type only 'someTool param1 param2'. Is that possible? regards, Achim |
Re: .py as executable extension on windows
Achim Domma (Procoders) schreef:
> is there a way to tell windows, that *.py files are executable, like > .bat, .js, ...? If I have someTool.py somewhere in my path I would like > to type only 'someTool param1 param2'. Is that possible? Google for "PATHEXT". -- JanC "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principles of the Internet - section 3.9 |
Re: .py as executable extension on windows
[Achim Domma]
> is there a way to tell windows, that *.py files are executable, like > .bat, .js, ...? If I have someTool.py somewhere in my path I would like > to type only 'someTool param1 param2'. Is that possible? Not on a command.com system (95/98/ME). On a cmd.exe system (NT/2K/XP), go to a DOS box and type ftype /? Skip down to the part explaining PATHEXT. |
Re: .py as executable extension on windows
Some useful information in Windows faq
http://www.python.org/doc/faq/window...pts-executable On Wed, 15 Sep 2004 22:30:33 +0200, Achim Domma (Procoders) <domma@procoders.net> wrote: > Hi, > > is there a way to tell windows, that *.py files are executable, like > .bat, .js, ...? If I have someTool.py somewhere in my path I would like > to type only 'someTool param1 param2'. Is that possible? > > regards, > Achim |
Re: .py as executable extension on windows
Or try "sometool.py param1 param2"! Works fine for me.
Stefan On 15.09.2004, at 22:54, aurora wrote: > Some useful information in Windows faq > > http://www.python.org/doc/faq/window...i-make-python- > scripts-executable > > > On Wed, 15 Sep 2004 22:30:33 +0200, Achim Domma (Procoders) > <domma@procoders.net> wrote: > >> Hi, >> >> is there a way to tell windows, that *.py files are executable, like >> .bat, .js, ...? If I have someTool.py somewhere in my path I would >> like to type only 'someTool param1 param2'. Is that possible? >> >> regards, >> Achim > > -- > http://mail.python.org/mailman/listinfo/python-list > > |
Re: .py as executable extension on windows
On Wed, 15 Sep 2004 16:45:41 -0400, Tim Peters <tim.peters@gmail.com> wrote:
>[Achim Domma] >> is there a way to tell windows, that *.py files are executable, like >> .bat, .js, ...? If I have someTool.py somewhere in my path I would like >> to type only 'someTool param1 param2'. Is that possible? > >Not on a command.com system (95/98/ME). On a cmd.exe system >(NT/2K/XP), go to a DOS box and type > > ftype /? > >Skip down to the part explaining PATHEXT. I'd forgotten where that was explained. Thanks. The OP might also want to know that NT/2K/XP is not a guarantee of full satifaction, (as you know ;-). I.e., note that some versions (e.g. NT4.0) of windows don't do i/o redirection properly for output generated by a script invoked via extension association. IOW, e.g., someTool param1 param2 > result.txt may give you an empty result.txt. Same for piping either input or output. This is not a python problem. The same will happen for perl (and super-weird hacks have been attempted to work around it IIRC ;-) So if you want to redicrect i/o on such windows versions, you will have to run the scripts explicitly as arguments to the python interpreter, e.g. python someTool.py param1 param2 > result.txt and you will need to specify a full path to someTool.py if you are not in the same directory. For stuff you use a lot, you will probably wind up writing someTool.cmd (whose ouput will be redirectable) as a one-line invocation of python and someTool.py (passing through all cmd line args). E.g., @python c:\pywk\ut\ppcomp2.py %* starts a little utility for me, which I invoke as ppcomp -- which runs ppcomp.cmd in c:\util -- which is on my session's path for the os's finding executables. IIRC there's also a way to rename .py to .cmd and put a tricky first line in to fake unix sort of and invoke python to interpret the rest as python, but I'm repressing memory of the details ;-) I guess newer windows versions don't have this problem so much, but it's worth knowing, so you can recognize the symptom when it happens. Regards, Bengt Richter |
| All times are GMT. The time now is 08:47 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.