How to run Python in Windows w/o popping a DOS box?

Bengt Richter bokr at oz.net
Fri Apr 22 14:39:15 EDT 2005


On 22 Apr 2005 09:55:13 -0700, pyguy2 at gmail.com wrote:

>>This change is NOT a good idea!!
>I agree the .pyw shortcut method is better. However, if you are willing
>to lose
>stdin,stdout,stderr and really never want a console window to pop up, I
>do not see how it is a disasterous change. You can still run python.exe
>on your py files when you want  to test your code.
Sure, but those are some if conditions ;-) And if it is a shared workstation
and you change it for the all-users profile, people are likely to be upset.

BTW, it is very easy from a C windows program to make a console window
pop up with stdin,stdout,stderr ready to go at the next code line.
It's a win32 C API called AllocConsole and it does nothing if a console window already exists.

I don't know what pythonw.exe does with std i/o that hasn't been intercepted,
but I would think it could be handy to have it force a console window, and maybe
have a pythonw.exe command line option to dump either or both stdout and stderr
silently. That way by default you'd see errors etc. unless you opt now to.
(I should check, maybe they've thought of this already. It's really easy to do)
... Nope, I don't see it in python -h (and pythonw -h doesn't show anything ;-)

>
>>What do you mean by "their command prompt"? The actual prompt of
>cmd.exe
>>or the command line interpretation? I agree the latter sucks, but I
>could
>>change the shell if I wanted to go to the trouble.
>Of course, but one cannot always change it  on boxes you have to deal
>with.  Probably in an effort to not compete with themselves, there are
>some basic  things a multi-hundred dollar operating system doesn't give
>you. Like, oh, a simple editor that has multiple levels of undue and
>redo.
Sigh ;-)

>
>>Actually, I don't really like os system info mixed in with application
>>info, which is what #!
>
>I think of it like the ''.join semantics. The object knows best how to
>handle join (even if it looks wierd to some people). In the #! case,
>the program knows best how to start itself.
>
This I don't understand ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list