【问题标题】:How to update a file in python egg如何在 python egg 中更新文件
【发布时间】:2011-04-13 18:10:27
【问题描述】:

我们正在使用 trac。在我们的设置中,我们有一个在存储库中解决的问题。所以我从存储库中得到了固定文件 commit_update.py,我需要将它放入 Trac-0.12-py2.6.egg。

因为 egg 只是一个压缩文件,我只是解压缩它,更改文件并再次压缩。重新启动 trac 后,我收到一条错误消息:

ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg 
cache:

    [Errno 20] Not a directory

The Python egg cache directory is currently set to: 

    /var/trac/plugin-cache

Perhaps your account does not have write access to this directory?  You can 
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.

我不太明白为什么会出现这个错误,因为我在 www-data 下运行 trac 实例,它是插件缓存的所有者。

将不胜感激任何想法。

【问题讨论】:

    标签: python trac egg


    【解决方案1】:

    只需构建一个新的 egg(使用python setup.py bdist_egg),重新安装 egg 并重新启动您的 trac 实例。

    【讨论】:

    • $ python setup.py bdist-egg python: can't open file 'setup.py': [Errno 2] No such file or directory
    • 我只有egg文件,如何重建?
    • 你从哪里弄来的鸡蛋?您是否使用 setuptools 安装了 trac(例如“easy_install tr​​ac”)?如果是:尝试使用easy_install -m trac 重新安装,然后删除egg 文件,然后easy_install -Z trac,它不是作为压缩的egg 安装,而是作为目录安装。然后您可以编辑源代码。
    • 谢谢。问题是不是我安装了那个鸡蛋。我通过下载 trac 源代码、更改文件并使用命令“python ./setup.py install”创建 egg 文件解决了我的问题。
    • 不是拼写bdist_egg吗?
    【解决方案2】:

    我只是使用解压缩鸡蛋文件

    sudo unzip django_tastypie-0.9.11-py2.7.egg
    

    这在同一路径中创建了一个名为tastepie的新文件夹,然后,我将文件更改为其中,然后删除了egg文件并继续仅使用新文件夹。

    【讨论】:

    • 嗯...我不喜欢将事物与您找到它们的方式不同的想法。我用它来编辑文件,然后创建一个新的.eggby running setup.py again
    猜你喜欢
    • 2018-07-26
    • 2011-05-17
    • 2011-04-08
    • 2012-09-25
    • 2018-04-27
    • 2010-10-25
    • 2011-12-29
    • 2015-07-21
    • 1970-01-01
    相关资源
    最近更新 更多