NameError: global name ‘log’ is not defined

March 21st, 2009

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.

321  mv setuptools-0.6c8-py2.5.egg setuptools-0.6c8-py2.5.zip
322  extract setuptools-0.6c8-py2.5.zip   # alias to extract an archived file
323  cd setuptools/
324  wget http://bugs.python.org/file10198/setuptools_patch.txt
325  patch -p0 < setuptools_patch.txt # this one didn't work. I was off by 1
326  patch -p1 < setuptools_patch.txt
327  ..  # alias to cd ..
328  rm setuptools-0.6c8-py2.5.zip
329  zip setuptools setuptools-0.6c8-py2.5.zip  # I never remember the proper order
330  zip setuptools-0.6c8-py2.5.zip setuptools
331  mv setuptools-0.6c8-py2.5.zip setuptools-0.6c8-py2.5.egg

Hope it helps someone!


Comments are disabled. If that bothers you, please contact me on twitter at @justinlilly and let me know.