Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 975
ccwhite1 Avatar asked Apr 12 '11 17:04

ccwhite1


1 Answers

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

like image 185
ccwhite1 Avatar answered Oct 18 '22 21:10

ccwhite1