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: "module importlib has no attribute 'machinery'" #205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tucksaun
Copy link

@tucksaun tucksaun commented Sep 3, 2024

This PR

Since the merge of #190, the following errors happens:

ERROR: module 'importlib' has no attribute 'machinery'
ERROR: Exceptions occurred during the run!
ERROR: AttributeError: module 'importlib' has no attribute 'machinery'

This commit should fix this by importing the required package.

  • I've read the DCO.
  • I've read the Coding Guidelines
  • The relevant informations about the changes stands in the commit message, not here in the message of the pull request.
  • Code changes follow the style of the files they change.
  • Code is tested (tested with my backup scripts).

References

Additional information

I'm no Python expert but it seems that importlib.machinery is only introduced in Python 3.3 so in order to maintain potential compatibility I added the import in the if clause just before it gets used. Let me know if you prefer if to be at the top of the file

Since the merge of OfflineIMAP#190, the following errors happens:
```
ERROR: module 'importlib' has no attribute 'machinery'
ERROR: Exceptions occurred during the run!
ERROR: AttributeError: module 'importlib' has no attribute 'machinery'
```
This commit should fix this by importing the required package.
@keithbowes
Copy link
Contributor

Are you using a pre-3.3 version of Python? I'm not getting this error in either the Python 3.10 provided by the distro I use or the Python 3.12 I got through Conda. Maybe it's time to bump the Python requirement (after all, imaplib2 3.6 requires Python 3.6+ and the latest imaplib2 code in their Git repo requires Python 3.10+); I try my best to make sure my contributions will work in older versions of Python, but the code would be so much less messy without having to make concessions for unreasonably old versions.

@tucksaun
Copy link
Author

tucksaun commented Sep 5, 2024

I have this error with the latest official python Docker images (3.12.5 as of writing) but I also had it with previous versions (I stopped my investigation after a couple of earlier versions, 3.9 IIRC)

@r7l
Copy link

r7l commented Sep 21, 2024

Can confirm this error with Python 3.11.9.

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 this pull request may close these issues.

3 participants