improving performance of writing into a pipe

mikprog at gmail.com mikprog at gmail.com
Mon Feb 18 17:31:45 CET 2013


On Monday, February 18, 2013 3:21:53 PM UTC, Oscar Benjamin wrote:
[..]
> 
> Can you not open the pipe file directly in Python code? e.g.
> 
> 
> 
> fout = open('/tmp/mypipe', 'w')
> 
> fout.write(data)
> 
> 
> 
> I guess that this would be more efficient than using os.popen to run echo.
> 
> 

that's an idea,
thanks Oscar.
However I get an exception while trying to open the queue:
fout = open('/tmp/mypipe', 'w')

I have tried it in a command line and the call doesn't return until in another terminal I open the same queue for reading (???)

I have created the queue with:
mkfifo /tmp/mypipe

any clue?
mik




More information about the Python-list mailing list