Using os.popen3() to get binary data

Thomas Krüger newsgroups at nospam.nowire.org
Fri Apr 6 07:59:37 EDT 2007


Christoph Krammer schrieb:

> for image in images:
>     if (image[0:3] == 'GIF'):
>       (si, so, se) = os.popen3('giftopnm -image=all', 'b')
>       si.write(image)
>       frame = so.readlines()
> 
> But with this code the script just hangs. When I interrupt the script,
> I get the following error message:
> Traceback (most recent call last):
>   File "/home/tiger/stock-spam/scripts/all_in_one.py", line 46, in ?
>     frames = so.readlines()
> KeyboardInterrupt
> close failed: [Errno 32] Broken pipe

Just a try: use read() instead of readlines()!

Thomas



More information about the Python-list mailing list