开发者

py2exe and sqlalchemy-migrate

I'm using python 2.6, sqlalchemy 0.6 for a tiny desktop application. Also i'm using py2exe and sqlalchemy-migrate and i'm trying to integrate migrate inside the exe. In this way when the user starts the application the database gets automatically upgraded.

If i try to use migrate in my eclipse project it works well but i want to开发者_运维百科 release the project itself in an exe using py2exe. Unfortunately when i start the exe i got the error:

Traceback (most recent call last):
File "sagra.py", line 7, in <module>
File "guiutil.pyc", line 3, in <module>
File "bo.pyc", line 4, in <module>
File "database.pyc", line 26, in <module>
File "<string>", line 2, in version_control
File "migrate\versioning\util\__init__.pyc", line 160, in with_engine
File "migrate\versioning\api.pyc", line 248, in version_control
File "migrate\versioning\schema.pyc", line 128, in create
File "migrate\versioning\repository.pyc", line 76, in __init__
File "migrate\versioning\repository.pyc", line 97, in verify
migrate.versioning.exceptions.InvalidRepositoryError: db_repository

but the directory db_repository and the migration scripts are correctly inside the "library.zip" used by py2exe to incorporate all the python resources used by my software.

It seems sqlalchemy-migrate doesn't search inside the zip for the directory of the repository.

Here the problem (repository.py):

def verify(cls, path):
"""
Ensure the target path is a valid repository.

:raises: :exc:`InvalidRepositoryError <migrate.versioning.exceptions.InvalidRepositoryError>`
"""
# Ensure the existence of required files
try:
    cls.require_found(path)
    cls.require_found(os.path.join(path, cls._config))
    cls.require_found(os.path.join(path, cls._versions))
except exceptions.PathNotFoundError, e:
    raise exceptions.InvalidRepositoryError(path) 

How to read the repository from a zip ? Is there anyone who have tried (and succeded) to use sqlalchemy-migrate inside the exe generated by py2exe ?

Thanks for any help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜