subprocess module under python 2.7

Discussion in 'Python' started by Timothy W. Grove, Jul 28, 2010.

  1. 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
    Timothy W. Grove, Jul 28, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Sampson

    Python Subprocess module

    Dave Sampson, Jul 13, 2007, in forum: Python
    Replies:
    8
    Views:
    649
    Dave Sampson
    Jul 21, 2007
  2. Harishankar
    Replies:
    18
    Views:
    602
    Harishankar
    Apr 23, 2008
  3. Harishankar
    Replies:
    2
    Views:
    310
    Mark Wooding
    Apr 23, 2008
  4. hiral
    Replies:
    2
    Views:
    582
    Jean-Michel Pichavant
    May 5, 2010
  5. Chris Rebert

    Re: subprocess module under python 2.7

    Chris Rebert, Jul 28, 2010, in forum: Python
    Replies:
    0
    Views:
    607
    Chris Rebert
    Jul 28, 2010
Loading...

Share This Page