After installing Babel on our development machine, Trac died with that error:
OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac/locale'
The issue seems to be related to #9439: When installing Trac, it checks whether Babel is installed or not. When Babel is installed, Trac also installs the locale files. The problem occurs when Babel is installed after installing Trac, because Trac expects the locale files to exists when Babel is installed.
As I don’t use locale with Trac, I couldn’t delete Babel (because I do use it with other stuff) and I didn’t want to re-install Trac – I took the hacky solution and modified trac/web/main.py so it’ll ignore the fact that Babel is installed and won’t use it at all. This can be done by commenting out the part that tries to import babel and setting the Locale to None manually. Open trac/web/main.py, look for (should be at line 29):
try: from babel import Locale except ImportError: Locale = None
and replace with:
#try: # from babel import Locale #except ImportError: # Locale = None Locale = None
Yes – very much hacky, but it works as a quick solution for now, as we must have Trac up and running. I will be looking for a better solution and update this post.