Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29026 > unrolled thread

Re: using subprocess.Popen does not suppress terminal window on Windows

Started byjanis.judvaitis@gmail.com
First post2012-09-13 05:33 -0700
Last post2012-09-13 13:58 -0400
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#29026 — Re: using subprocess.Popen does not suppress terminal window on Windows

Fromjanis.judvaitis@gmail.com
Date2012-09-13 05:33 -0700
SubjectRe: using subprocess.Popen does not suppress terminal window on Windows
Message-ID<86dbbda6-6cac-4a01-b575-85ab24421221@googlegroups.com>
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

[toc] | [next] | [standalone]


#29058

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-09-13 13:58 -0400
Message-ID<mailman.624.1347559091.27098.python-list@python.org>
In reply to#29026
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/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web