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

Fix circular imports error during Loader registration #910

Open
Horofic opened this issue Oct 17, 2024 · 0 comments · May be fixed by #911
Open

Fix circular imports error during Loader registration #910

Horofic opened this issue Oct 17, 2024 · 0 comments · May be fixed by #911
Assignees

Comments

@Horofic
Copy link
Contributor

Horofic commented Oct 17, 2024

During Loader registration some loaders incorrectly fail to import due to ImportError's caused by circular imports, such as the RemoteLoader (remote.py).

\*\*\* ImportError: Failed to lazily import dissect.target.loaders.remote: cannot import name 'Target' from partially initialized module 'dissect.target.target' (most likely due to a circular import) (/projects/dissect/dissect.target/dissect/target/target.py)
Traceback (most recent call last):
  File "/usr/local/Cellar/[email protected]/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pdb.py", line 366, in displayhook
    self.message(repr(obj))
  File "/projects/dissect/dissect.target/dissect/target/helpers/lazy.py", line 66, in __repr__
    return f"<lazyattr {self.module._module_name}.{self.attr} loaded={self.realattr is not None}>"
  File "/projects/dissect/dissect.target/dissect/target/helpers/lazy.py", line 51, in realattr
    self._realattr = getattr(self.module._module, self.attr)
  File "/projects/dissect/dissect.target/dissect/target/helpers/lazy.py", line 38, in __getattr__
    self._error()
  File "/projects/dissect/dissect.target/dissect/target/helpers/lazy.py", line 32, in _error
    raise ImportError(f"Failed to lazily import {self.module._module_name}: {self.exc}")  # noqa
@Horofic Horofic self-assigned this Oct 17, 2024
@Horofic Horofic linked a pull request Oct 17, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant