I've posted this few minutes ago on c.l.python, but since I'm
desperate, I'll do it here to:
I'm working with SQLAlchemy 0.3.3, Python 2.5 and py2exe 0.6.5. This
simple scripts fails when I run test.exe:
*** test.py: ***
import sqlalchemy
print 'Test'
***
It works when interpreted by Python, but when running it from compiled
py2exe binary, it fails with this error:
Traceback (most recent call last):
File "main.py", line 1, in <module>
File "sqlalchemy\__init__.pyc", line 10, in <module>
File "sqlalchemy\orm\__init__.pyc", line 12, in <module>
File "sqlalchemy\orm\mapper.pyc", line 7, in <module>
File "sqlalchemy\logging.pyc", line 30, in <module>
ImportError: No module named logging
Ofcourse, library.zip (in the dist directory) contains 'sqlalchemy
\logging.pyc'. After I copy logging.pyc to library.zips' root, I get
this error:
Traceback (most recent call last):
File "main.py", line 1, in <module>
File "sqlalchemy\__init__.pyc", line 10, in <module>
File "sqlalchemy\orm\__init__.pyc", line 12, in <module>
File "sqlalchemy\orm\mapper.pyc", line 7, in <module>
File "sqlalchemy\logging.pyc", line 30, in <module>
File "sqlalchemy\logging.pyc", line 33, in <module>
AttributeError: 'module' object has no attribute 'getLogger'
I really don't know what to do next, so any kind of help is
appreciated. First of all, I'm wondering is this SQLAlchemys' problem,
or is py2exe guilty?
Thanks guys...
so short answer, "theyre both guilty"...SA for expecting absolute
module behavior, py2exe for assuming relative.
show the py2exe folks the evil thing im doing in sqlalchemy.logging (im
importing the python's "logging" via __import__) and im sure theyll
shake their heads in disgust....if they cant offer a solution, and you
are truly "desperate", youll have to change the name "logging" (and
maybe "types" as well) throughout your SA dist.
I had similar problem with module "postgres". py2exe didn't automaticaly
include the module so I simply put "import
sqlalchemy.databases.postgres" into the main script. Perhaps you should
try something like this with the logging.
DS
Karlo Lozovina píše v Út 19. 12. 2006 v 04:01 +0000:
Karlo Lozovina said the following on 19.12.2006 6:01:
> I'm working with SQLAlchemy 0.3.3, Python 2.5 and py2exe 0.6.5. This
> simple scripts fails when I run test.exe:
> ImportError: No module named logging
Have you solved this problem? I want to try to use py2exe also.
--
Oleg