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

"Relative import error in h5py files.py: Cannot import filename_decode and filename_encode" #2460

Open
jjeeenny opened this issue Jul 22, 2024 · 3 comments

Comments

@jjeeenny
Copy link

Problem:
While working with the h5py library for handling HDF5 files, I encountered an import error in the files.py file of h5py. The error message is ImportError: attempted relative import with no known parent package.

python
import sys
import os
from warnings import warn

from .compat import filename_decode, filename_encode ( from .compat import filename_decode, filename_encode
ImportError: attempted relative import with no known parent package)

from .base import phil, with_phil
from .group import Group
from .. import h5, h5f, h5p, h5i, h5fd, _objects
from .. import version

@tacaswell
Copy link
Member

How did you install h5py?

@jjeeenny
Copy link
Author

How did you install h5py?

I created a virtual environment in Command Prompt and installed h5py within that environment before importing h5py in my code.

@tacaswell
Copy link
Member

Can you provide the full trackback? This looks like you are in the h5py source while trying to import it and/or your installation is broken.

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

2 participants