[python-win32] How to make python scripts output to current cmd window? (like linux terminal)

Mike Driscoll mdriscoll at co.marshall.ia.us
Tue Nov 18 15:38:39 CET 2008


Tim Roberts wrote:
> Tim Roberts wrote:
>   
>> sayeo87 wrote:
>>   
>>     
>>> Right now on Windows I have added ".py" to my PATHEXT so that I can run .py
>>> files by doing ./<filename>.py. But when I do this the output of the program
>>> goes to a new command prompt window which instantly disappears. How can I
>>> instead make the output go to the current command prompt window I'm working
>>> in, like in a linux terminal?
>>>
>>> Sorry if this has been answered before but I've googled high and low and
>>> still can't seem to find how to do this.
>>>   
>>>     
>>>       
>> What PATHEXT lets you do is run the command without specifying a path at
>> all.
>>     
>
> I realized when I read my reply that I really did nothing to clear up
> any confusion.  Allow me to provide an example.
>
> Let's say I have c:\bin\remote.py, and client.py in the current
> directory.  WIthout the file associations for .py and .pyw, I can say:
>     python client.py
>     pythonw client.py
> If I set up file associations for .py and .py, then I can also say:
>     client.py
>     .\client.py
> Further, as long as "c:\bin" is in the path, I can also say:
>     remote.py
>   


Sorry to intrude, but what is "C:\bin" ? I don't have it on Windows XP 
and I couldn't find a "bin" folder in my Python25 directory either. Is 
this some kind of custom wizardry on your part?

Mike



More information about the python-win32 mailing list