Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__package__ = None #39

Open
jhgoebbert opened this issue Apr 26, 2018 · 0 comments
Open

__package__ = None #39

jhgoebbert opened this issue Apr 26, 2018 · 0 comments

Comments

@jhgoebbert
Copy link

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=<ipynb.fs.finder.FSFinder object>, 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 = <built-in method startswith of str object at 0x7f41805a6580>
        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
tonyfast added a commit to deathbeds/ipynb that referenced this issue Jan 2, 2020
* Refactor the compile notebook and expose an export function to format our development code.
* Add docstring information to the readme
* Add a docstring test.
* Explicit names for the compiler and exporter classes giving a nicer graph structure
* End the markdown quotes on a new lines
* Explicit class names for the parameterize functions.
* Add an ability to load python files as modules with from_filename
* Format source code.
* Doctest a module in the tests.
* Remove the tox requirements and use pytest syntax for the tests.
* Add more tests
* Skip the docstring test in 3.7 until the docstring is fixed
* modify how the changelog is read and remove the markdown version
    * Include the changelog.ipynb in the manifest
* Make Notebook classes callable and make from_filename an regular method.
* Use the default IPython transformer
* Update the benchmark with the new from file code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant