kindlegen is now forced to terminate
A bug in kindlegen causes it randonly to hang when converting epub to mobi. This happens above 90% of the time it is called so this change foce it to be killed as soon kcc detects it's donne the job. For this to work shell arg must be false. Otherwise terminate() will try to kill the new opened cmd/terminal instead of kindlegen.
This commit is contained in:
1 parent
4b1c7b3124
commit
cb9059c231
1 file changed
+4
-1
+4
-1
@@ -1226,8 +1226,9 @@ def makeMOBIWorker(item):
|
|||||||
kindlegenError = ''
|
kindlegenError = ''
|
||||||
try:
|
try:
|
||||||
if os.path.getsize(item) < 629145600:
|
if os.path.getsize(item) < 629145600:
|
||||||
|
print("Creating MOBI file...")
|
||||||
output = Popen('kindlegen -dont_append_source -locale en "' + item + '"',
|
output = Popen('kindlegen -dont_append_source -locale en "' + item + '"',
|
||||||
stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=False)
|
||||||
for line in output.stdout:
|
for line in output.stdout:
|
||||||
line = line.decode('utf-8')
|
line = line.decode('utf-8')
|
||||||
# ERROR: Generic error
|
# ERROR: Generic error
|
||||||
@@ -1239,6 +1240,8 @@ def makeMOBIWorker(item):
|
|||||||
kindlegenErrorCode = 23026
|
kindlegenErrorCode = 23026
|
||||||
if kindlegenErrorCode > 0:
|
if kindlegenErrorCode > 0:
|
||||||
break
|
break
|
||||||
|
if "Mobi file built successfully" in line:
|
||||||
|
output.terminate()
|
||||||
else:
|
else:
|
||||||
# ERROR: EPUB too big
|
# ERROR: EPUB too big
|
||||||
kindlegenErrorCode = 23026
|
kindlegenErrorCode = 23026
|
||||||
|
|||||||
Reference in new issue
Block a user