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

Empty __init__.py: Need from ccx2paraview import ccx2paraview instead of import ccx2paraview #31

Open
pstelzig opened this issue Aug 22, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@pstelzig
Copy link

pstelzig commented Aug 22, 2023

Problem description

When installing ccx2paraview under Ubuntu 22.04 using pip like

pip3 install --user ccx2paraview

pip will create a file ~/.local/lib/python3.10/site-packages/ccx2paraview/__init__.py that turns ccx2paraview into a Python module.

The __init__.py is empty, and therefore the module ccx2paraview -- when importing in a Python file -- has no members except again the submodule ccx2paraview (because the folder ~/.local/lib/python3.10/site-packages/ccx2paraview contains the file ccx2paraview.py).

Hence, in order to access the module elements from ccx2paraview one has to state from ccx2paraview import ccx2paraview and then all elements are again available like e.g. ccx2paraview.Converter

Desired behavior

After import ccx2paraview in a Python file have the relevant members of ccx2paraview available like ccx2paraview.Converter etc.

Potential fix

Include a file __init__.py into the ccx2paraview repository with content like

from .ccx2paraview import *

to import everything from the ccx2paraview.py or

from .ccx2paraview import Converter
from .ccx2paraview import <whatever a user needs>

I modified the empty __init__.py like this and it worked.

@pstelzig pstelzig changed the title pip install creates empty __init__.py file Empty __init__.py: Need from ccx2paraview import ccx2paraview instead of import ccx2paraview Sep 13, 2023
@imirzov imirzov added the bug Something isn't working label May 13, 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
Development

No branches or pull requests

2 participants