473,230 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

.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
Jul 18 '05 #1
5 2065
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
Jul 18 '05 #2
[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.
Jul 18 '05 #3
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)
<do***@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


Jul 18 '05 #4
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)
<do***@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


Jul 18 '05 #5
On Wed, 15 Sep 2004 16:45:41 -0400, Tim Peters <ti********@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
Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: QQ June | last post by:
Hello, I have some java classes. But, I don't want my users to type "java my_java_program" every time they run the java class ? How do I pack them together into one executable file, like...
17
by: Filipe Martins | last post by:
Hello. I've read somewhere that the executable is smaller if we use a source file for each function! So, I tested this with gcc and it seams to confirm! What seams to happen is that if we call...
3
by: Johnny | last post by:
How do I create a link on a Web page on my hard drive that will run an executable file on my hard drive? For example, let's say I create runpoodle.htm and save it to my hard drive, and let's...
3
by: Gustavo L. Fabro | last post by:
Greetings! I'm testing VS 2005 Beta 2, and I've compiled a program that runs just fine on my computer (where VS is installed). I've tried to run this same program on another computer (after...
8
by: suresh_C# | last post by:
Dear All, What is difference between Portable Executable (PE) file and a Assembly? Thanks, Mahesh
2
by: pooja | last post by:
what is an assembly and how does it related with portable executable in ..net architecture?
28
by: Tim Daneliuk | last post by:
I have a program wherein I want one behavior when a file is set as executable and a different behavior if it is not. Is there a simple way to determine whether a given named file is executable...
16
by: Erwin Moller | last post by:
Why is a binary file executable? Is any binary file executable? Is only binary file executable? Are all executable files binary? What is the connection between the attribute of binary and that of...
1
by: KMEscherich | last post by:
Hi there, am totally new at creating an executable for a PDF file. I have created a PDF file and placed it on a CD. Now, I want to be able to have this PDF file automatically open up in any...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.