py2exe 和 sqlalchemy-migrate
我正在使用 python 2.6、sqlalchemy 0.6 作为一个小型桌面应用程序。另外,我正在使用 py2exe 和 sqlalchemy-migrate,并且我正在尝试将 migrate 集成到 exe 中。这样,当用户启动应用程序时,数据库就会自动升级。
如果我尝试在我的 eclipse 项目中使用 migrate 它效果很好,但我想使用 py2exe 在 exe 中发布项目本身。不幸的是,当我启动 exe 时,出现错误:
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
但是目录 db_repository 和迁移脚本正确地位于 py2exe 使用的“library.zip”内,以合并我的软件使用的所有 python 资源。
看来 sqlalchemy-migrate 不会在 zip 中搜索存储库的目录。
这里的问题(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)
如何从 zip 读取存储库? 有没有人尝试过(并成功)在 py2exe 生成的 exe 中使用 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论