Py2exe issue

238 views
Skip to first unread message

sylvain_gd

unread,
Jun 10, 2010, 4:27:34 PM6/10/10
to pyodbc
Before filling a bug I would like to ask you a question.
I am not able to use pyodbc with py2exe.

Environnment:
Windows XP Pro
Python 2.5
pyodbc
py2exe

How to reproduce:
create a module test.py:

import pyodbc

create a module setup.py:
from distutils.core import setup
import py2exe
setup( console=["test.py" ] )


launch python.exe setup.py py2exe
cd dist
launch test.exe

==> Error Message:
Traceback (most recent call last):
File "test.py", line 1, in <module>
ImportError: No module named pyodbc


Has someone already seen this issue?

sylvain_gd

unread,
Jun 10, 2010, 4:37:10 PM6/10/10
to pyodbc
I tried with python2.6 same issue

sylvain_gd

unread,
Jun 10, 2010, 4:49:53 PM6/10/10
to pyodbc
Ok,
I installed pyodbc via easy_install.

If I extract the pyodbc egg I don't have the issue, but if I keep the
pyodbc modue in the egg, it does not work (note that if DOES work in
an interactive python console)

sylvain_gd

unread,
Jun 10, 2010, 5:19:40 PM6/10/10
to pyodbc
Sorry, actually it does not work even if I unpack the egg.

There is some kind of bug… :-(

On 10 juin, 16:37, sylvain_gd <sylvain.gro...@gmail.com> wrote:

mkleehammer

unread,
Jun 10, 2010, 6:21:31 PM6/10/10
to pyodbc
I don't know what the bug is, but I don't think it is pyodbc. I use
it every day for Windows services, but I just tried your test and I
get different results.

In my case, I get an error because the decimal module wasn't found.
This is covered here: http://code.google.com/p/pyodbc/wiki/py2exe

and is easily fixed using this:

import py2exe
from distutils.core import setup

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

Here is the contents of my dist directory. Make sure pyodbc.pyd is in
there.

10/02/2009 20:42 71,168 bz2.pyd
6/10/2010 17:00 1,552,234 library.zip
4/16/2010 13:33 74,240 pyodbc.pyd
10/02/2009 20:41 2,140,160 python26.dll
10/02/2009 20:43 11,776 select.pyd
6/10/2010 17:00 18,944 test.exe
10/02/2009 20:42 585,728 unicodedata.pyd
10/02/2009 20:40 49,664 w9xpopen.exe

The script I used was:

import pyodbc

I also tested by actually using pyodbc and that worked also.

I suspect it isn't getting the correct test.py or something of that
nature.

wilke.c...@t-online.de

unread,
Dec 7, 2012, 10:36:58 AM12/7/12
to pyo...@googlegroups.com
Your setup script needs  a few more options on what to include. Found the problem here:

http://stackoverflow.com/questions/2551003/exe-created-by-py2exe-give-error
Reply all
Reply to author
Forward
0 new messages