How to update a file in python egg
Asked Answered
L

2

6

We are using trac. In our setup we have a problem that is solved in repository. So I got the fixed file commit_update.py from the repository and I need to place it into Trac-0.12-py2.6.egg.

As egg is just a ziped filed I just unziped it, changed the file and ziped again. After restarting trac, I've got a an error message:

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.

I don't quite understand why I got this error, because I'm running trac instance under www-data and it is the owner of the plugin-cache.

Will appreciate any ideas.

Laminitis answered 17/9, 2010 at 14:9 Comment(0)
C
7

Just build a new egg (with python setup.py bdist_egg), reinstall the egg and restart your trac instance.

Congressman answered 17/9, 2010 at 14:15 Comment(5)
$ python setup.py bdist-egg python: can't open file 'setup.py': [Errno 2] No such file or directoryLaminitis
I have only egg file, how can i rebuild it?Laminitis
Where did you get the egg? Did you install trac with setuptools (e.g. "easy_install trac")? If yes: try reinstalling with easy_install -m trac, then delete the egg file, then easy_install -Z trac, which installs not as a zipped egg, but as a directory. Then you can edit the source.Congressman
Thank you. The problem was that it wasn't me who have installed that egg. I've solved my problem by downloading trac source code, changing the file and creating the egg file with the command "python ./setup.py install".Laminitis
Isn't it spelled bdist_egg?Existent
A
4

I just unzip the egg file using

sudo unzip django_tastypie-0.9.11-py2.7.egg

This created a new folder in same path called tastypie, then, I changed files into it, and after that, I removed the egg file and keep using only the new folder.

Alexandriaalexandrian answered 30/9, 2012 at 15:21 Comment(1)
Hm... I don't like the idea of leaving things differently to how you find them. I'm using this to edit the files, then creating a new .egg by running setup.py againHiro

© 2022 - 2024 — McMap. All rights reserved.