Search code examples
pyodbccx-freeze

cx_freeze error with pyodbc


if you have a simple program name pyodbcTest.py

import pyodbc
print "pass"

and then use cx_freeze to compile it

cxfreeze --targe-dir=cxTest pyodbcTest.py

and then run that program it throws the following error.

C:\temp\pythonWork\cxTest>pyodbcTest.exe                                                         
Traceback (most recent call last):                                                               
    File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>     
        exec code in m.__dict__                                                                     
    File "pyodbcTest.py", line 1, in <module>                                           
 RuntimeError: Unable to import decimal       

Any ideas?


Solution

  • I had to add the option --include-module decimal to solve the problem. Not sure why it could not find that one on its own during the freeze process, but its working now