NameError: global name 'log' is not defined

I've spent a portion of this evening trying to get caught up with the crazy amounts of development that have been going on with the oebfare blogging engine over the past few weeks. I have a nice little Ubuntu VM setup that works really nicely, but when gathering the requirements for the projects, I hit a snag. I apparently had a borked setuptools (installed via apt) which resulted in the error::

NameError: global name 'log' is not defined

To fix this, find your setuptools location. For me, it was relatively easy as I'm using virtualenvwrapper so it was located in ~/.virtualenvs/oebfare/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg

After a brief google search, I came across a patch which seems to fix the issue, which you can find here. To apply the patch, rename your .egg file to a .zip, extract it, patch the repository, zip it back up, rename it, and you should be set. Here are the commands I ran to do that.

mv setuptools-0.6c8-py2.5.egg setuptools-0.6c8-py2.5.zip
unzip setuptools-0.6c8-py2.5.zip
cd setuptools/
wget http://bugs.python.org/file10198/setuptools_patch.txt
patch -p1 < setuptools_patch.txt
cd ..
rm setuptools-0.6c8-py2.5.zip
zip setuptools-0.6c8-py2.5.zip setuptools
mv setuptools-0.6c8-py2.5.zip setuptools-0.6c8-py2.5.egg

Hope it helps someone!

© 2012 - 2023 · Home — Theme Simpleness