FirebirdSQL/python3-driver

Can't import connect from firebird.driver ?

linuxguy123 opened this issue · 6 comments

from firebird.driver import connect

Traceback (most recent call last):
  File "/home/me/Development/xxx/./xxx.py", line 39, in <module>
    from firebird.driver import connect
  File "/home/me/.local/lib/python3.11/site-packages/firebird/driver/__init__.py", line 38, in <module>
    from .config import driver_config, ServerConfig, DatabaseConfig, DriverConfig
  File "/home/me/.local/lib/python3.11/site-packages/firebird/driver/config.py", line 43, in <module>
    from firebird.base.config import Config, StrOption, IntOption, BoolOption, EnumOption, \
  File "/home/me/.local/lib/python3.11/site-packages/firebird/base/config.py", line 58, in <module>
    from enum import Enum, Flag, _decompose
ImportError: cannot import name '_decompose' from 'enum' (/usr/lib64/python3.11/enum.py)

$ python --version
Python 3.11.0rc2

$ pip install firebird-base
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: firebird-base in /home/me/.local/lib/python3.11/site-packages (1.4.2)
Requirement already satisfied: protobuf>=4.21.1 in /home/me/.local/lib/python3.11/site-packages (from firebird-base) (4.21.9)
$ pip install firebird-driver
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: firebird-driver in /home/me/.local/lib/python3.11/site-packages (1.6.0)
Requirement already satisfied: firebird-base>=1.4.2 in /home/me/.local/lib/python3.11/site-packages (from firebird-driver) (1.4.2)
Requirement already satisfied: python-dateutil>=2.8 in /usr/lib/python3.11/site-packages (from firebird-driver) (2.8.2)
Requirement already satisfied: protobuf>=4.21.1 in /home/me/.local/lib/python3.11/site-packages (from firebird-base>=1.4.2->firebird-driver) (4.21.9)
Requirement already satisfied: six>=1.5 in /usr/lib/python3.11/site-packages (from python-dateutil>=2.8->firebird-driver) (1.16.0)

Does the same thing with the full release version.
$ python --version
Python 3.11.0

$ pip --version
pip 22.2.2 from /usr/lib/python3.11/site-packages/pip (python 3.11)

That's funny. Line 58 of https://github.com/FirebirdSQL/python3-base/blob/master/firebird/base/config.py is

from enum import Enum, Flag

It doesn't have _decompose in it.

LOL... the commit has "pcisar Fixed problem with enum internal functions removed in Python 3.11"

So it is fixed in Master as of Oct 10, 2022.

According to pip, I have firebird-base 1.4.2 installed. The code in it has _decompose in it.

So the fix has been done in Master, but not pushed to pip.

Could we get Master tagged as a new version (1.4.3?) and pushed to pip ?

Certainly, as 3.11 was officially released, it's now worth the effort to rush the release.

Did you push it already ? pip still has 1.4.2.

Yes, about 3 hours ago, see https://pypi.org/project/firebird-base/

It came through. It works now.

$ pip list | grep firebird
firebird-base 1.4.3
firebird-driver 1.6.0

Thanks for your efforts.