Commit 3ed2fead authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

output error if conversion failed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23561 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f526c64f
...@@ -377,8 +377,9 @@ class Image(File, OFSImage): ...@@ -377,8 +377,9 @@ class Image(File, OFSImage):
process = subprocess.Popen(parameter_list, process = subprocess.Popen(parameter_list,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True) close_fds=True)
imgin, imgout = process.stdin, process.stdout imgin, imgout, err = process.stdin, process.stdout, process.stderr
def writeData(stream, data): def writeData(stream, data):
if isinstance(data, str): if isinstance(data, str):
...@@ -395,7 +396,7 @@ class Image(File, OFSImage): ...@@ -395,7 +396,7 @@ class Image(File, OFSImage):
newimg.write(imgout.read()) newimg.write(imgout.read())
imgout.close() imgout.close()
if not newimg.tell(): if not newimg.tell():
raise ConversionError('Image conversion failed (empty file).') raise ConversionError('Image conversion failed (%s).' % err.read())
newimg.seek(0) newimg.seek(0)
return newimg return newimg
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment