__package__ = None
- Linguagem predominante
- Jupyter Notebook
- Estrelas
- 258
- Forks
- 71
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Start in ipynb/fs/finder.py at FSFinder.find_spec and inspect how package_prefix is derived from __package__. Compare that value with __spec__.parent while reproducing an import of a notebook under the reported circumstances. Done means the finder no longer passes None to startswith and the notebook import succeeds.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- jupyter-notebook, python
- Domínio
- tooling
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100