Maxmium bufsize using open2?

Discussion in 'Python' started by Thomas =?ISO-8859-15?Q?G=FCttler?=, Jul 10, 2003.

  1. Maurice wrote:

    > Dear all,
    >
    > I've a problem using popen2 when using large files.
    > When I use small input files everything works well but when I feed large
    > inputfile to the pipe nothing happens. Is there a maximum bufsize for
    > using the pipe. The code I use is written down here below. Do I need to
    > specify a waittime between line 4 and 5 ?
    >
    >
    > o,i =popen2('command '))
    > fh=open(os.path.join(self.dirname, self.filename),'r')
    > i.write(fh.read())
    > i.close()
    > self.StringData=o.read()
    > o.close()


    Hi,

    Have a look at the select module.

    thomas
    Thomas =?ISO-8859-15?Q?G=FCttler?=, Jul 10, 2003
    #1
    1. Advertising

  2. Thomas =?ISO-8859-15?Q?G=FCttler?=

    Maurice Guest

    Dear all,

    I've a problem using popen2 when using large files.
    When I use small input files everything works well but when I feed large
    inputfile to the pipe nothing happens. Is there a maximum bufsize for
    using the pipe. The code I use is written down here below. Do I need to
    specify a waittime between line 4 and 5 ?


    o,i =popen2('command '))
    fh=open(os.path.join(self.dirname, self.filename),'r')
    i.write(fh.read())
    i.close()
    self.StringData=o.read()
    o.close()
    Maurice, Jul 10, 2003
    #2
    1. Advertising

  3. As someone else already mentioned, using select is another solution.
    All solution amount to the fact the input and output to the process are
    interleaved.
    --
    Piet van Oostrum <>
    URL: http://www.cs.uu.nl/~piet [PGP]
    Private email:
    Piet van Oostrum, Jul 12, 2003
    #3
    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. Jonathan Hudgins

    popen bufsize not allowed on windows

    Jonathan Hudgins, Jul 24, 2004, in forum: Python
    Replies:
    1
    Views:
    362
    Jonathan Hudgins
    Jul 25, 2004
  2. I. Myself
    Replies:
    2
    Views:
    482
    I. Myself
    Apr 30, 2006
  3. =?iso-8859-1?B?aWFuYXLp?=

    real time updating of popen, bufsize=0 problems

    =?iso-8859-1?B?aWFuYXLp?=, Apr 6, 2007, in forum: Python
    Replies:
    4
    Views:
    573
    =?iso-8859-1?B?aWFuYXLp?=
    Apr 6, 2007
  4. Steve Holden
    Replies:
    0
    Views:
    775
    Steve Holden
    Feb 8, 2009
  5. Jerry Krinock
    Replies:
    9
    Views:
    264
    Jerry Krinock
    Sep 19, 2009
Loading...

Share This Page