You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mssql-python not working from Pyinstaller generated exe #733
I'm trying to create a Windows executable with PyInstaller, but I'm getting the following error even though I've included all the necessary DLL, RLL, and PYD files in the package. Do you have any suggestions on how to fix this?
Error message when trying to run dist\hello\hello.exe:
File "mssql_python\connection.py", line 127, in _raise_connection_error
mssql_python.exceptions.OperationalError: Driver Error: Connection operation failed; DDBC Error: Unable to cast Python instance of type <class 'NoneType'> to C++ type '?' (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)
[PYI-86436:ERROR] Failed to execute script 'hello' due to unhandled exception!
Minimal reproducible example:
pyproject.toml
[project]
name = "mssql-python-pyinstaller"version = "0.1.0"description = "Add your description here"readme = "README.md"requires-python = ">=3.12"dependencies = [
"mssql-python>=1.14.0",
]
[dependency-groups]
dev = [
"pyinstaller>=6.22.2",
]
Activity
github-actions commentedon Aug 31, 2026
Hi Jari Laurila (@jariml), thank you for opening this issue!
Our team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.
If you have additional information to share, please feel free to update the issue.
Thank you for your patience!
jariml commentedon Aug 31, 2026
I managed to get this working. mssql_python_odbc was just missing from hidden imports. Working hello.spec: