Python OSError not reporting errors
Posted
by breathe
on Stack Overflow
See other posts from Stack Overflow
or by breathe
Published on 2010-03-26T00:03:27Z
Indexed on
2010/03/26
0:13 UTC
Read the original article
Hit count: 735
python
|imagemagick
Ive got this snippet that Im using to convert image files to tiff. I want to be informed when a file fails to convert. Imagemagick exits 0 when successfully run, so I figured the following snippet would report the issue. However no errors are being reported at all.
def image(filePath,dirPath,fileUUID,shortFile):
try:
os.system("convert " + filePath + " +compress " + dirPath + "/" + shortFile + ".tif")
except OSError, e:
print >>sys.stderr, "image conversion failed: %s" % (e.errno, e.strerror)
sys.exit(-1)
© Stack Overflow or respective owner