Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

py2exe + sqlalchemy + sqlite problem

I am playing around with getting some basic stuff to work in Python before i go into full speed dev mode. Here are the specifics:

Python 2.5.4
PyQt4 4.4.3
SqlAlchemy 0.5.2
py2exe 0.6.9
setuptools 0.6c9
pysqlite 2.5.1

setup.py:

from distutils.core import setup
import py2exe

setup(windows=[{"script" : "main.py"}], options={"py2exe" : {"includes" : ["sip", "PyQt4.QtSql","sqlite3"],"packages":["sqlite3",]}})

py2exe appears to generate the .exe file correctly, but when i execute dist/main.exe i get this in the main.exe.log

Traceback (most recent call last):
  File "main.py", line 18, in <module>
  File "main.py", line 14, in main
  File "db\manager.pyc", line 12, in __init__
  File "sqlalchemy\engine\__init__.pyc", line 223, in create_engine
  File "sqlalchemy\engine\strategies.pyc", line 48, in create
  File "sqlalchemy\engine\url.pyc", line 91, in get_dialect
ImportError: No module named sqlite

I've been googling my heart out, but can't seem to find any solutions to this. If i can't get this to work now, my hopes of using Python for this project will be dashed and i will start over using Ruby... (not that there is anything wrong with Ruby, i just wanted to use this project as a good way to teach myself Python)

like image 483
Jason Miesionczek Avatar asked Feb 24 '09 16:02

Jason Miesionczek


2 Answers

you need to include the sqlalchemy.databases.sqlite package

setup(
  windows=[{"script" : "main.py"}],
  options={"py2exe" : {
    "includes": ["sip", "PyQt4.QtSql"],
    "packages": ["sqlalchemy.databases.sqlite"]
}})
like image 179
Toni Ruža Avatar answered Oct 02 '22 23:10

Toni Ruža


you need change to sqlalchemy.dialects.sqlite package

setup( windows=[{"script" : "main.py"}], options={"py2exe" : { "includes": ["sip", "PyQt4.QtSql"], "packages": ["sqlalchemy.dialects.sqlite"] }})

like image 38
Hope Avatar answered Oct 02 '22 22:10

Hope