FirebirdSQL / python3-driver

Firebird driver for Python that uses new Firebird API
https://www.firebirdsql.org/en/devel-python-driver/
MIT License
27 stars 10 forks source link

Can't import connect from firebird.driver ? #16

Closed linuxguy123 closed 1 year ago

linuxguy123 commented 1 year ago

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)
linuxguy123 commented 1 year ago

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)

linuxguy123 commented 1 year ago

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 ?

pcisar commented 1 year ago

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

linuxguy123 commented 1 year ago

Did you push it already ? pip still has 1.4.2.

pcisar commented 1 year ago

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

linuxguy123 commented 1 year ago

It came through. It works now.

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

Thanks for your efforts.