subprocess.Popen on Windows

Discussion in 'Python' started by madpython, Jun 23, 2006.

  1. madpython

    madpython Guest

    playing with subprocess.Popen on Windows I stumbled into the following
    problem:
    Python 2.4.3 (#69, Mar 29 2006, 17:35:34)

    IDLE 1.1.3

    >>> import subprocess
    >>> p1=subprocess.Popen("c:\\asd.bat") #works OK
    >>> p2=subprocess.Popen("c:\\asd.bat",stdout=subprocess.PIPE)


    Traceback (most recent call last):
    File "<pyshell#2>", line 1, in -toplevel-
    p2=subprocess.Popen("c:\\asd.bat",stdout=subprocess.PIPE)
    File "C:\Python24\lib\subprocess.py", line 533, in __init__
    (p2cread, p2cwrite,
    File "C:\Python24\lib\subprocess.py", line 593, in _get_handles
    p2cread = self._make_inheritable(p2cread)
    File "C:\Python24\lib\subprocess.py", line 634, in _make_inheritable
    DUPLICATE_SAME_ACCESS)
    TypeError: an integer is required
    >>>

    What do I do wrongly?
    madpython, Jun 23, 2006
    #1
    1. Advertising

  2. madpython

    3c273 Guest

    "madpython" <> wrote in message
    news:...
    > playing with subprocess.Popen on Windows I stumbled into the following
    > problem:
    > Python 2.4.3 (#69, Mar 29 2006, 17:35:34)
    >
    > IDLE 1.1.3
    >
    > >>> import subprocess
    > >>> p1=subprocess.Popen("c:\\asd.bat") #works OK
    > >>> p2=subprocess.Popen("c:\\asd.bat",stdout=subprocess.PIPE)

    >
    > Traceback (most recent call last):
    > File "<pyshell#2>", line 1, in -toplevel-
    > p2=subprocess.Popen("c:\\asd.bat",stdout=subprocess.PIPE)
    > File "C:\Python24\lib\subprocess.py", line 533, in __init__
    > (p2cread, p2cwrite,
    > File "C:\Python24\lib\subprocess.py", line 593, in _get_handles
    > p2cread = self._make_inheritable(p2cread)
    > File "C:\Python24\lib\subprocess.py", line 634, in _make_inheritable
    > DUPLICATE_SAME_ACCESS)
    > TypeError: an integer is required
    > >>>

    > What do I do wrongly?
    >

    I get the same thing. This only happens when using IDLE. From a command
    prompt, everthing works as expected. Hopefully somebody else will know why.
    Louis
    3c273, Jun 23, 2006
    #2
    1. Advertising

  3. madpython

    mmamsch Guest

    On 23.06.2006 23:12:02, "3c273" wrote:
    >"madpython" <> wrote in message
    >news:...
    >> playing with subprocess.Popen on Windows I stumbled into the following
    >> problem:
    >> Python 2.4.3 (#69, Mar 29 2006, 17:35:34)
    >>
    >> IDLE 1.1.3
    >>
    >> >>> import subprocess
    >> >>> p1=subprocess.Popen("c:\\asd.bat") #works OK
    >> >>> p2=subprocess.Popen("c:\\asd.bat",stdout=subprocess.PIPE)

    >>
    >> Traceback (most recent call last):
    >> File "<pyshell#2>", line 1, in -toplevel-
    >> p2=subprocess.Popen("c:\\asd.bat",stdout=subprocess.PIPE)
    >> File "C:\Python24\lib\subprocess.py", line 533, in __init__
    >> (p2cread, p2cwrite,
    >> File "C:\Python24\lib\subprocess.py", line 593, in _get_handles
    >> p2cread = self._make_inheritable(p2cread)
    >> File "C:\Python24\lib\subprocess.py", line 634, in _make_inheritable
    >> DUPLICATE_SAME_ACCESS)
    >> TypeError: an integer is required
    >> >>>

    >> What do I do wrongly?
    >>

    >I get the same thing. This only happens when using IDLE. From a command
    >prompt, everthing works as expected. Hopefully somebody else will know why.
    >Louis
    >
    >


    I think IDLE replaces the sys.stdin and sys.stdout by a class to redirect IO.
    So when using IDLE stdin and stdout are not integer handles anymore.

    Greetings, Mathias
    mmamsch, Jun 24, 2006
    #3
  4. madpython

    Uri Nix Guest

    Uri Nix, Jun 25, 2006
    #4
    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. Méta-MCI

    Windows, subprocess.Popen & encodage

    Méta-MCI, May 8, 2007, in forum: Python
    Replies:
    2
    Views:
    386
  2. Tim Golden
    Replies:
    0
    Views:
    449
    Tim Golden
    Oct 7, 2007
  3. Replies:
    8
    Views:
    733
  4. Werner F. Bruhin

    subprocess.Popen on Windows

    Werner F. Bruhin, Oct 20, 2008, in forum: Python
    Replies:
    1
    Views:
    304
    Eric Carlson
    Oct 20, 2008
  5. Mark Shewfelt
    Replies:
    1
    Views:
    603
    yomgui
    Nov 6, 2008
Loading...

Share This Page