ipython / ipython/ipynb

__package__ = None

未关闭
#39 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
258
派生
71
PR 合并指标
30 天内没有已合并 PR

描述

Hi,

I found that under certain circumstances `__package__` is not defined and hence FSFinder has no package_prefix set. This leads to an error when trying to import a notebook.

Can it be that this is because `__package__` is expected to be the same as __spec__.parent beginning with Python 3.6?
https://docs.python.org/3/reference/import.html#__package__

Anyway, relying on `__package__` seems to be a risk.

Best,
Jens Henrik

---------------------
```
...python3.6/site-packages/ipynb-0.5.1-py3.6.egg/ipynb/fs/finder.py in find_spec(self=, fullname='ipynb.fs.full.job_submit', path=['...site-packages/ipynb-0.5.1-py3.6.egg/ipynb/fs/full'], target=None)
41 Claims modules that are under ipynb.fs
42 """
---> 43 if fullname.startswith(self.package_prefix):
fullname.startswith =
self.package_prefix = None
44 for path in self._get_paths(fullname):
45 if os.path.exists(path):

TypeError: startswith first arg must be str or a tuple of str, not NoneType
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。