Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29058
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: using subprocess.Popen does not suppress terminal window on Windows |
| Date | 2012-09-13 13:58 -0400 |
| Organization | > Bestiaria Support Staff < |
| References | <9dc66012-988e-4581-aaab-169dbadbbf93@35g2000vbj.googlegroups.com> <86dbbda6-6cac-4a01-b575-85ab24421221@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.624.1347559091.27098.python-list@python.org> (permalink) |
On Thu, 13 Sep 2012 05:33:25 -0700 (PDT), janis.judvaitis@gmail.com
declaimed the following in gmane.comp.python.general:
> It looks like normal terminal to me, could You define normal?
>
> Looks like it appears only when target script prints something, but it shouldn't cus I'm using pipes on stdout and stderr.
>
> If anyone is interested I'm using function doPopen from here: http://code.google.com/p/mansos/source/browse/trunk/tools/IDE/src/helperFunctions.py
What does
E:\UserData\Wulfraed\My Documents>echo %comspec%
C:\WINDOWS\system32\cmd.exe
show for your system (not that I'm expecting much difference -- as long
as it isn't the 16-bit command.com <G>)
Is there any chance your spawned programs are opening/reading STDIN?
That would be sufficient to cause Windows to open a console window. You
may need to specify a pipe for STDIN.
You may also want to examine (in Python 2.7) chapter 17.1.3 "Windows
Popen Helpers"
OR, maybe
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682528%28v=vs.85%29.aspx
"""
The system creates a new console when it starts a console process, a
character-mode process whose entry point is the main function. For
example, the system creates a new console when it starts the command
processor. When the command processor starts a new console process, the
user can specify whether the system creates a new console for the new
process or whether it inherits the command processor's console.
"""
Note that the console creation is a function of the Windows
operating system, and not of the Python subprocess library. Also, if you
main process is running under pythonw (explicitly, or via a .pyw
extension) your main process itself does not have a console to inherit
(pythonw uses, I believe, the WinMain entry point which identifies a
graphical interface).
Some Googling indicates that ActiveState's Perl includes a wperl.exe
which behaves similar to pythonw.exe -- run as a graphical application,
not a console application. However -- I don't know if you can thereby
use pipes for communication (graphical application doesn't have
stdin/stdout)...
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: using subprocess.Popen does not suppress terminal window on Windows janis.judvaitis@gmail.com - 2012-09-13 05:33 -0700 Re: using subprocess.Popen does not suppress terminal window on Windows Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-13 13:58 -0400
csiph-web