Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Maxmium bufsize using open2? (http://www.velocityreviews.com/forums/t319479-maxmium-bufsize-using-open2.html)

Thomas =?ISO-8859-15?Q?G=FCttler?= 07-10-2003 10:17 AM

Re: Maxmium bufsize using open2?
 
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


Maurice 07-10-2003 11:46 AM

Maxmium bufsize using open2?
 
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()



Piet van Oostrum 07-12-2003 11:00 AM

Re: Maxmium bufsize using open2?
 
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 <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum@hccnet.nl


All times are GMT. The time now is 03:04 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.