在 Jupyter 中使用自定义 ContentsManager 创建新文件

Creating new files with custom ContentsManager in Jupyter

我正在为 Jupyter Notebooks 编写自定义 ContentsManager 管理器并开始创建新文件。

最初我的 file_exists 函数总是 returned True 并且我得到 Cannot POST to files, use PUT instead 错误,与 this issue 相同。

之后,我将 file_exists 函数修改为 return False,但是现在 Jupyter 卡在循环调用 file_exists 中:

/dir
/dir/Untitled.ipynb
/dir/Untitled1.ipynb
/dir/Untitled2.ipynb
...

我的问题是 - 我应该从 file_exists return 做什么才能继续创建笔记本?

虽然我可能 getsavefile_exists 之后接到电话,但情况似乎并非如此。

exist - 错误

exist_dir 对于目录 - true

exist_dir 文件 - false

那就是门票。