tmolomby / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Unable to import decimal with py2exe generated Executable #305

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I generated a executable using py2exe on a windows machine. However, the 
generated executable fails to execute with the error indicated below.

D:\ScannerTool\dist>SerialTool.exe
Traceback (most recent call last):
  File "SerialTool.py", line 2, in <module>
  File "pyodbc.pyc", line 12, in <module>
  File "pyodbc.pyc", line 10, in __load
RuntimeError: Unable to import decimal

I am running on Windows XP SP3 32 Bit.

I read on the link http://www.py2exe.org/index.cgi/PyODBC that by including an 
additional option, i can get around this error but despite having generated the 
executable with this option, the error persists.

Appreciate your help on this.

Here is my setup.py for reference.

from distutils.core import setup
import py2exe , sys
from glob import glob
sys.path.append('C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.
0.50727.6195_x-ww_44262b86')
#setup(options = {"py2exe": { "dll_excludes": ["OCI.dll"],"includes": 
"decimal"}},)
setup(options = {"py2exe": {"includes": "decimal"}},)
setup(console=['SerialTool.py'])

Regards,
Anurag

Original issue reported on code.google.com by Anu...@mimansa.cl on 9 Jan 2013 at 6:59

GoogleCodeExporter commented 9 years ago
Just solved this. Besides putting an option in the setup.py file, I should also 
include an import of decimal module in my SerialTool.py script. 

I could not find a way to close this issue.

Regards,
Anurag

Original comment by Anu...@mimansa.cl on 9 Jan 2013 at 11:02

GoogleCodeExporter commented 9 years ago

Original comment by mkleehammer on 28 Mar 2013 at 10:29

GoogleCodeExporter commented 9 years ago
The option simply needs to be added to same call to setup, eg:

setup(
    console=['setup.py'],
    options={"py2exe": {"includes": "decimal"}}
)

Original comment by csmcpher...@gmail.com on 16 Sep 2014 at 3:20