afewmail / afew

an initial tagging script for notmuch mail
ISC License
325 stars 97 forks source link

Issue on python-3.12 with configparser removed from python #341

Open GuillaumeSeren opened 9 months ago

GuillaumeSeren commented 9 months ago

Hey, Since we fixed #338, we can see that there is an issue on configparser with python-3.12: the error look like this:

____________ ERROR collecting afew/tests/test_dkimvalidityfilter.py ____________
ImportError while importing test module '/home/runner/work/afew/afew/afew/tests/test_dkimvalidityfilter.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/importlib/__init__.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
afew/tests/test_dkimvalidityfilter.py:10: in <module>
from afew.Database import Database
afew/Database.py:8: in <module>
import notmuch
env/lib/python3.12/site-packages/notmuch/__init__.py:54: in <module>
from .database import Database
env/lib/python3.12/site-packages/notmuch/database.py:24: in <module>
from .compat import SafeConfigParser
env/lib/python3.12/site-packages/notmuch/compat.py:50: in <module>
from configparser import SafeConfigParser
E   ImportError: cannot import name 'SafeConfigParser' from 'configparser' (/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/configparser.py). Did you mean: 'RawConfigParser'?

Searching a little arround this error get me those:

I am 100% if the issue is in afew or notmuch, it look like a good contribution for the project if someone want to dig this out.

kopinions commented 6 months ago

Hey, Since we fixed #338, we can see that there is an issue on configparser with python-3.12: the error look like this:

____________ ERROR collecting afew/tests/test_dkimvalidityfilter.py ____________
ImportError while importing test module '/home/runner/work/afew/afew/afew/tests/test_dkimvalidityfilter.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/importlib/__init__.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
afew/tests/test_dkimvalidityfilter.py:10: in <module>
from afew.Database import Database
afew/Database.py:8: in <module>
import notmuch
env/lib/python3.12/site-packages/notmuch/__init__.py:54: in <module>
from .database import Database
env/lib/python3.12/site-packages/notmuch/database.py:24: in <module>
from .compat import SafeConfigParser
env/lib/python3.12/site-packages/notmuch/compat.py:50: in <module>
from configparser import SafeConfigParser
E   ImportError: cannot import name 'SafeConfigParser' from 'configparser' (/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/configparser.py). Did you mean: 'RawConfigParser'?

Searching a little arround this error get me those:

I am 100% if the issue is in afew or notmuch, it look like a good contribution for the project if someone want to dig this out.

It seem u have use the wrong notmuch version. The SafeConfigParser have been fix by notmuch already. Try to install notmuch 0.38.2, and use python3 setup.py install to install afew works for me

kofm commented 5 months ago

With notmuch 0.38.3+17~gcd89065 and afew installed using latest commit with python setup.py install --prefix=~/.local I get the same exact error :(

EDIT: After a little bit of digging I was able to fix it by editing both afew and notmuch-python-bindings. As @GuillaumeSeren correctly pointed out this is happening because of the recent changes to configparser. I don't know if you want me to try to prepare a pull request

atanasj commented 3 months ago

@kofm, what did you do to fix this?

GuillaumeSeren commented 3 months ago

Heya, thank you for making this issue rolling.

@kopinions, did you try to run the test from you local install ?

@kofm Nice, can you open a PR ?