Windows XP - cron or scheduler for Python?

Thorsten Kampe thorsten at thorstenkampe.de
Mon Jun 21 20:01:09 CEST 2004


* Peter Hansen (2004-06-21 19:35 +0200)
> Ivan Voras wrote:
>> Peter Hansen wrote:
>>> Larry Bates wrote:
>>>> 2) Always call Python and have it run the application.
>>>> Don't just try to run progname.py.
>>>
>>> This actually works, though, at least on my system.  It
>>> might be because I inserted .py in the PATHEXT env var
>>> globally, though I thought it was just because running
>>> a .py is possible simply by clicking on it in Explorer
>>> (ie. the File Association does the job).
>> 
>> No, putting .py in PATHEXT is necessary. That way, you can run python 
>> programs from the command line (cmd) using just "scriptname", without 
>> the extension! (it performs just like .bat, .exe and similar files)
> 
> Are you sure?  I just tried removing .py from my PATHEXT and
> not only did it still work from Explorer, it even worked from
> the command line!
> 
> Then I tried redirecting the File Assocation under File Types
> to point to notepad instead of python.  Now typing "xxx.py"
> at the command line or clicking on the xxx.py file in
> Explorer both launch Notepad to edit the file.
> 
> I'm not sure what PATHEXT is really needed for, but executing
> .py files on the command line in Windows XP does not seem to
> be one of them...

"PATHEXT" enables you to run files in the path with these extensions 
without extension (for example "winword" instead of "winword.exe"). 
The cmd shell actually performs an "open" action. For executables 
"opening" is running them. For documents it's starting the associated 
application and opening the document in it. For .py both things are 
reasonable.

Thorsten



More information about the Python-list mailing list