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

Load ipynb contained from a different directory #53

Open
andrea-vandin opened this issue Mar 6, 2021 · 2 comments
Open

Load ipynb contained from a different directory #53

andrea-vandin opened this issue Mar 6, 2021 · 2 comments

Comments

@andrea-vandin
Copy link

Let us suppose my main notebook (main.ipynb) is next to a folder otherpath containing another notebook to be imported (to_be_imported.ipynb).

If I do
import ipynb.fs.defs.otherpath.to_be_imported

I get
ModuleNotFoundError: No module named 'ipynb.fs.defs.otherpath'

If I move to_be_imported.ipynb in the same folder of the main file, everything works.

@FranklynSeabraOSF
Copy link

I have this same issue

@tobias-edwards
Copy link

Seeems ipynb doesn't support package imports i.e.

|- package_a
   |- __init__.py
   |- module_a.ipynb
|- module_b.ipynb            import ipynb.fs.full.package_a.module_a

As a result, I've resorted to:

|- package_a
   |- module_a.ipynb
|- module_b.ipynb           import sys
                            import os
                            sys.path.insert(0, f"{os.getcwd()}/package_a")

                            import ipynb.fs.full.module_a

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

3 participants