你的
args
是错误的。你要说的是
$ ./file.ipynb tempfile.ipynb nbconvert --to notebook \
--execute --ExecutePrerocessor.timeout=60 --output
这不起作用,因为
file.ipynb
不是可执行文件。你需要调用
jupyter
相反:
$ jupyter nbconvert ./file.ipynb --output tempfile.ipynb --to notebook \
--execute --ExecutePrerocessor.timeout=60
翻译成python
阿尔茨海默病
,例如:
import shutil
...
jupyter_exec = shutil.which('jupyter')
if jupyter_exec is not None:
args = [jupyter_exec, "nbconvert", path,
"--output", fout.name,
"--to", "notebook",
"--execute", "--ExecutePreprocessor.timeout=60"]
subprocess.check_call(args)
else:
# jupyter not installed or not found in PATH