Circular dependency?
goldstar611 opened this issue · comments
I'm found your repository while looking for up-to-date repos that use PyQt5 and OpenGL.
main.py doesn't run because import Processing.Utilities as PU
fails but if you run the command again (like in a interactive shell it works the 2nd time) so I think there's a circular dependency in Processing/Utilities/PeakFunctions/peak_estimators.py
Maybe I'm launching the program wrong?
>>> import Processing.Utilities
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/Desktop/EMPeaks/src/Processing/Utilities/__init__.py", line 4, in <module>
from .image import hann_window, smooth_step, smooth_circle_like, point_is_on_edge_of_image, get_image_region
File "/home/user/Desktop/EMPeaks/src/Processing/Utilities/image.py", line 3, in <module>
from Processing.Utilities.PeakFunctions.peak_functions import gaussian_2d
File "/home/user/Desktop/EMPeaks/src/Processing/Utilities/PeakFunctions/__init__.py", line 3, in <module>
from .peak_estimators import estimate_gauss_parameter, estimate_lorentz_parameter, estimate_pearson_parameter, estimate_voigt_parameter, estimate_skewed_gauss_parameter
File "/home/user/Desktop/EMPeaks/src/Processing/Utilities/PeakFunctions/peak_estimators.py", line 3, in <module>
import Processing.Utilities as PU
AttributeError: module 'Processing' has no attribute 'Utilities'
>>> import Processing.Utilities
Yes, peak_estimators.py
imports point_is_on_edge_of_image
and get_image_region
from image.py
and image.py
imports gaussian_2d
from peak_estimators.py
.
So peak_estimators.py cant load with out first loading image.py but image.py cant load without first loading peak_estimators.py.
I don't know if you are using an out of date version of the code, but this is not an issue I have or can replicate.
I run the program just by calling python .\__main__.py
on windows.
For me image.py
imports gaussian_2d
from peak_functions.py
, not peak_estimators.py
. This should avoid the circular import. I think this has been the case since at least early September?