mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-04 21:54:57 +01:00
Make PDF conversion on OSX more robust. Fixes #1927 (PDF->MOBI traceback)
This commit is contained in:
parent
42a4ed14ca
commit
670f450d78
1 changed files with 15 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
''''''
|
||||
|
||||
import sys, os, subprocess, logging
|
||||
import errno
|
||||
from functools import partial
|
||||
from calibre import isosx, setup_cli_handlers, filename_to_utf8, iswindows, islinux
|
||||
from calibre.ebooks import ConversionError, DRMError
|
||||
|
|
@ -41,14 +42,26 @@ def generate_html(pathtopdf, tdir):
|
|||
try:
|
||||
os.chdir(tdir)
|
||||
try:
|
||||
p = popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
p = popen(cmd, stderr=subprocess.PIPE)
|
||||
except OSError, err:
|
||||
if err.errno == 2:
|
||||
raise ConversionError(_('Could not find pdftohtml, check it is in your PATH'), True)
|
||||
else:
|
||||
raise
|
||||
|
||||
'''
|
||||
print p.stdout.read()
|
||||
ret = p.wait()
|
||||
'''
|
||||
while True:
|
||||
try:
|
||||
ret = p.wait()
|
||||
break
|
||||
except OSError, e:
|
||||
if e.errno == errno.EINTR:
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
|
||||
if ret != 0:
|
||||
err = p.stderr.read()
|
||||
raise ConversionError, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue