我现在用下面的代码在python-3.8.10
和Ubuntu 20
上.尽管每一次try ,超时似乎都不起作用.我不确定我是不是把文本输入错了?
cmd = 'ebook-convert "%s" "%s"' % (filename, outfile)
process = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=77400)
try:
ConversionFile.set_to_finished(options.get('uuid'))
if process.stderr and "error" in process.stderr.decode("utf-8"):
return {'error': process.stderr.decode("utf-8")}
return [outfile]
except Exception as e:
print(str(e))
然而,程序运行的时间超过了超时时间,并且从未被终止