Dan*_*ris 9 jupyter jupyter-notebook nbconvert
我正在使用 nbconvert.preprocessors.ExecutePreprocessor 以编程方式执行笔记本。我的笔记本依赖于相对文件名指定的资源,并且我无法让内核以指定的目录作为工作目录运行。换句话说,这个:
runPath = r'd:\blah\myPreferredDirectory'
proc = ExecutePreprocessor(timeout=600, kernel_name='python3')
proc.preprocess(nb, {'metadata': {'path':runPath}})
Run Code Online (Sandbox Code Playgroud)
...不尊重指定的路径。如果我将当前目录的打印输出插入到我的笔记本中,它不是指定的目录,但如果我指定了无效的目录,我确实会收到错误,所以它至少确认该目录存在。修改笔记本以显式更改目录不是一种选择。
建议?
使用 nbconvert 命令行也可以,尽管我更喜欢以编程方式执行此操作。
| 归档时间: |
|
| 查看次数: |
350 次 |
| 最近记录: |