Closed bsteubing closed 3 years ago
Hi Chris, I wouldn't know right now how to add a good test for this... if you could handle that, that would be really great as I think it would take you a fraction of the time I would need for this...
OK, I will make a test case.
This PR breaks my bw. With the latest master version I receive an error when importing brightway:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\benjamin.portner\programs\miniconda\envs\bw_dev\lib\site-packages\brightway2\__init__.py", line 2, in <module>
from bw2data import *
File "C:\Users\benjamin.portner\programs\miniconda\envs\bw_dev\lib\site-packages\bw2data\__init__.py", line 33, in <module>
from .project import projects
File "C:\Users\benjamin.portner\programs\miniconda\envs\bw_dev\lib\site-packages\bw2data\project.py", line 6, in <module>
from .utils import maybe_path
File "C:\Users\benjamin.portner\programs\miniconda\envs\bw_dev\lib\site-packages\bw2data\utils.py", line 5, in <module>
from .project import ProjectDataset, SubstitutableDatabase
ImportError: cannot import name 'ProjectDataset' from partially initialized module 'bw2data.project' (most likely due to a circular import) (C:\Users\benjamin.portner\programs\miniconda\envs\bw_dev\lib\site-packages\bw2data\project.py)
Could it be that there are files missing in the commit?
@cmutel I am not sure what goes wrong in Ben's case... do you know?
@cmutel This problem persists. I cannot develop on the current master branch due to the changes.
Think I found the reason:
project.py
: from .utils import maybe_path
utils.py
: from .project import ProjectDataset, SubstitutableDatabase
--> circular import
Hi Chris, something like this would be very useful to have at the level of brightway...