Open zevaryx opened 2 years ago
Hi @zevaryx, sorry about that. The CPython developers decided postpone the changes to the enum
module until 3.11 which is what broke the import.
It should be sorted in version 0.6.5. Can you try that version, and if it works for you I'll close the issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm having the same issue with Python 3.12.4 and enum_tools@0.9.0-post1
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
OMITTED
File "/Users/arne/Developer/bahlo/xxx/.venv/lib/python3.12/site-packages/enum_tools/__init__.py", line 30, in <module>
from enum_tools.custom_enums import AutoNumberEnum, DuplicateFreeEnum, IntEnum, OrderedEnum, StrEnum
File "/Users/arne/Developer/bahlo/xxx.venv/lib/python3.12/site-packages/enum_tools/custom_enums.py", line 50, in <module>
from enum import _power_of_two
ImportError: cannot import name '_power_of_two' from 'enum' (/Users/arne/.local/share/mise/installs/python/3.12.4/lib/python3.12/enum.py)
~How can I fix this?~ 0.9.0-post1 has the import, 0.9.0 doesn't have it. Needs a bump of enum-tools in the dependency.
Can you upgrade to the latest enum-tools (0.12.0), or is there a conflict with another dependency? 0.10.0 and 0.11.0 also have the fix for this issue.
On Wed, 31 Jul 2024, 09:07 Arne Bahlo, @.***> wrote:
I'm having the same issue with Python 3.12.4 and @.***
Traceback (most recent call last): File "
", line 198, in _run_module_as_main File " ", line 88, in _run_code OMITTED File "/Users/arne/Developer/bahlo/xxx/.venv/lib/python3.12/site-packages/enum_tools/init.py", line 30, in from enum_tools.custom_enums import AutoNumberEnum, DuplicateFreeEnum, IntEnum, OrderedEnum, StrEnum File "/Users/arne/Developer/bahlo/xxx.venv/lib/python3.12/site-packages/enum_tools/custom_enums.py", line 50, in from enum import _power_of_two ImportError: cannot import name '_power_of_two' from 'enum' (/Users/arne/.local/share/mise/installs/python/3.12.4/lib/python3.12/enum.py) How can I fix this?
— Reply to this email directly, view it on GitHub https://github.com/domdfcoding/enum_tools/issues/39#issuecomment-2259916834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5NRJOGQQQ5H2Z67HYRA2TZPCLMBAVCNFSM6AAAAABLX5M7FOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJZHEYTMOBTGQ . You are receiving this because you were assigned.Message ID: @.***>
Description
Adding
enum_tools.autoenum
to Sphinx on Python 3.10 causes the following error:ImportError: cannot import name '_power_of_two' from 'enum'
Steps to Reproduce
make html
withenum_tools.autoenum
installedActual result:
ImportError: cannot import name '_power_of_two' from 'enum'
Expected result:
Better enum autodocs
Reproduces how often:
Easily reproduced
Version
Installation source
PyPi
Other Additional Information:
A solution would be to replace enum_tools/custom_enums.py#L50 with the Python main branch implementation