Using sqlalchemy-firebird with firebird-driver and PyInstaller #67
-
I fought with this issue a lot today and finally found a solution, so sharing the question and answer both here... Question:When trying to bundle my application that uses sqlalchemy-firebird and firebird-driver for the driver with PyInstaller, I get the following error when it tries to load:
The program runs fine when not frozen, so it seems to be an issue with PyInstaller recognizing the drivers for firebird. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
AnswerBe sure to manually register the dialect in your application. I used the following code right before I created my connection string, but since the non-frozen application doesn't actually need it, it probably doesn't matter as much where it goes. It just needs to be somewhere that PyInstaller will pick it up when it's freezing. from sqlalchemy.dialects import registry
registry.register(
"firebird",
"sqlalchemy_firebird.firebird",
"FBDialect_firebird"
)
registry.register(
"firebird.firebird",
"sqlalchemy_firebird.firebird",
"FBDialect_firebird",
) I also included the following hidden-imports for PyInstaller (in my case, in my spec file). I'm not sure if all of these are necessary, but I know at least hidden_imports = [
'sqlalchemy_firebird',
'sqlalchemy_firebird.firebird',
'firebird',
'firebird.base',
'firebird.driver',
] This was using |
Beta Was this translation helpful? Give feedback.
Answer
Be sure to manually register the dialect in your application. I used the following code right before I created my connection string, but since the non-frozen application doesn't actually need it, it probably doesn't matter as much where it goes. It just needs to be somewhere that PyInstaller will pick it up when it's freezing.
I also included the following hidden-imports for PyInstaller (in my case,…