Hello everybody,
I need to get the different frames from a GIF image in my python
script and want to use the giftopnm program from netpbm to get the
frames and directly convert them to pnm files. I tried to use the
following code:
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
Can somebody tell me, which command I have to use that the pipe will
be closed when the giftopnm returns? This program just prints the
converted images to stdout and terminates.
Thanks in advance,
Christoph 3 2034
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
Just got the solution...
After sending the image data with "si.write(image)", I have to close
the pipe to tell the program to convert the image with "si.close()".
Now everything works fine.
Christoph
On Apr 6, 6:09 pm, Dennis Lee Bieber <wlfr...@ix.netcom.comwrote:
On 6 Apr 2007 04:02:52 -0700, "Christoph Krammer"
<redtige...@googlemail.comdeclaimed the following in comp.lang.python:
Hello everybody,
I need to get the different frames from a GIF image in my python
script and want to use the giftopnm program from netpbm to get the
frames and directly convert them to pnm files. I tried to use the
following code:
for image in images:
if (image[0:3] == 'GIF'):
What type of data /is/ "image" that the FIRST three characters
identify the type? If it's the name of the file (I don't know what
giftopnm requires for input) I'd have expected the last three to
identify..
[snip]
FYI, the first 3 bytes of a GIF image are the ASCII characters "GIF". This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rajarshi Guha |
last post by:
Hi,
I have some code that runs an interactive program via popen3(). The program generates
output which is then used later on. My script looks like this:
o,i,e =...
|
by: Chris Green |
last post by:
Hey folks,
I'm whipping up a quick CGI to wrap a command line app and I was a bit
suprised to not find a execl-like Popen3 style object. I don't want
to bother with the shell interpreting...
|
by: Ruchika |
last post by:
Hi,
I want to build an embedded Visual C++ project from the python script.
This is what I do -
evc = r'"C:\Program Files\Microsoft eMbedded C++
4.0\Common\EVC\Bin\EVC.EXE"'
proj =...
|
by: Russell E. Owen |
last post by:
I'm trying to launch an application from Python 2.3 on Windows. The
application is "ds9" (an image viewer), and is installed in C:\Program
Files\ds9\ds9
On unix I just do:
os.popen3("ds9")
and...
|
by: Jeffrey Barish |
last post by:
I have an application that has been working fine on Linux, but now I need to
port it to Windows XP. The program uses Popen3 to run another program. I
use Popen3 so that I can access the pid...
|
by: Pierre Rouleau |
last post by:
Hi all,
I have a consistent test case where os.popen3() hangs in Windows. The
system hangs when retrieving the lines from the child process stdout.
I know there were several reports related to...
|
by: Jonathan Mark |
last post by:
hi all...
I wrote a seemingly simple function (below) to use Popen3() and select()
to run a program and capture its exit status, stdout output, and stderr
output.
It worked fine until the box...
|
by: Rocky Zhou |
last post by:
python unzip
At first, I tried to use 'os.popen3("unzip ...") like this:
fin, fout, ferr = os.popen3("unzip -o -d %s %s" % (dest, zipfile))
strerr = ferr.read()
# This makes the program hanging...
|
by: Christoph Krammer |
last post by:
Hello everybody,
I try to use an external OCR tool to convert some binary image data to
text. The image is in one variable, the text should be converted to
another. I use the following code:
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |