subprocess module under python 2.7

T

Timothy W. Grove

I am using the following code to hide the console window when launching
a subprocess under Windows.

startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE

self.mplayer = Popen(args,
bufsize=0, #unbufferred
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
close_fds=False,
universal_newlines=True,
startupinfo=startupinfo
)

This worked okay in using the subprocess module under python 2.6, but
under python 2.7 I get the error:

Exception in thread Thread-1:
Traceback (most recent call last):
File "threading.pyo", line 530, in __bootstrap_inner
File "gui\mplayer_ctrl.pyo", line 93, in run
AttributeError: 'module' object has no attribute 'STARTF_USESHOWWINDOW'

Anything changed between python versions to account for this?

Best regards,
Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top