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

ModuleNotFoundError vs. ImportError #1016

Closed
CBroz1 opened this issue Jul 2, 2024 · 4 comments
Closed

ModuleNotFoundError vs. ImportError #1016

CBroz1 opened this issue Jul 2, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@CBroz1
Copy link
Member

CBroz1 commented Jul 2, 2024

We typically run a try/except on optional dependencies, excepting an ImportError. Depending on the user environment, this may raise ModuleNotFoundError. This was the case in VSCode's Jupyter debugger view.

An easy enough solve would be to...

try:
    import x
except (ModuleNotFoundError, ImportError) as e:
    x = None # We're inconsistent on this, and it helps for static linters
    logger.warning(e)
@edeno
Copy link
Collaborator

edeno commented Jul 3, 2024

Which cases cause the ModuleNotFoundError?

@CBroz1 CBroz1 added the bug Something isn't working label Jul 3, 2024
@CBroz1
Copy link
Member Author

CBroz1 commented Jul 3, 2024

I saw this declaring some custom table in VSCode-managed Jupyter yesterday - specifically, dj_mixin.py raised ModuleNotFoundError attempting to import Pynapple

@edeno
Copy link
Collaborator

edeno commented Jul 3, 2024

I am confused as to why it perceives this as a module rather than as a package.

CBroz1 added a commit to CBroz1/spyglass that referenced this issue Jul 9, 2024
edeno pushed a commit that referenced this issue Jul 9, 2024
@edeno
Copy link
Collaborator

edeno commented Jul 9, 2024

Closed by #1023

@edeno edeno closed this as completed Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants