mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Fix #134.
This commit is contained in:
parent
fb2a358c73
commit
6650029e89
@ -42,11 +42,14 @@ def generate_html(rtfpath):
|
|||||||
cmd = ' '.join([UNRTF, '"'+rtfpath+'"'])
|
cmd = ' '.join([UNRTF, '"'+rtfpath+'"'])
|
||||||
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
||||||
file.write(p.stdout.read())
|
file.write(p.stdout.read())
|
||||||
file.close()
|
|
||||||
ret = p.wait()
|
ret = p.wait()
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
|
if isosx and ret == -11: #unrtf segfaults on OSX but seems to convert most of the file.
|
||||||
|
file.write('</body>\n</html>')
|
||||||
|
else:
|
||||||
raise ConversionError, 'unrtf failed with error code: %d'%(ret,)
|
raise ConversionError, 'unrtf failed with error code: %d'%(ret,)
|
||||||
print 'done'
|
print 'done'
|
||||||
|
file.close()
|
||||||
return path
|
return path
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user