This commit is contained in:
Kovid Goyal 2007-08-05 03:41:41 +00:00
parent fb2a358c73
commit 6650029e89

View File

@ -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)