[python-win32] How to make python scripts output to current cmd window? (like linux terminal)
sayeo87
yeosuanaik at gmail.com
Mon Nov 17 21:42:23 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
>
> When I add .PY and .PYW to PATHEXT, that also lets me say:
> client
> remote
>
> without the extension. That's the sole purpose for PATHEXT.
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
>
Thanks for your reply, Tim. Regarding your earlier question about me not
using cmd when doing "./myFile.py", that was true - I was using PowerShell.
And I learned something about your explanation regarding PATHEXT. Turns out
I won't need that in the forseeable future, as all I want to do is execute
.py files in the CURRENT directory, WITHOUT taking away the ".py" extension.
I guess that has something to say about trying random solutions one sees
online without actually finding out what they do =^D
--
View this message in context: http://www.nabble.com/How-to-make-python-scripts-output-to-current-cmd-window--%28like-linux-terminal%29-tp20528072p20547776.html
Sent from the Python - python-win32 mailing list archive at Nabble.com.
More information about the python-win32
mailing list