Can't install TocMacro plugin
|Reported by:||w@…||Owned by:||coderanger|
When trying to load the TocMacro plugin, Trac fails with the following error (from the log file):
ImportError: cannot import name parse_args
Below I've detailed my steps to install and run the plugin.
First I've downloaded and build the TocMacro egg the following way:
[~]# fetch -o tocmacro.zip "http://trac-hacks.org/changeset/latest/tocmacro?old_path=/&filename=tocmacro&format=zip" [~]# tar -xzf tocmacro.zip [~]# cd tocmacro/0.11/ [~/tocmacro/0.11/]# python setup.py bdist_egg
Then I ran easy_install to make the plugin available from all Trac projects:
[~/tocmacro/0.11/]# cd dist [~/tocmacro/0.11/dist]# easy_install TracTocMacro-188.8.131.52-py2.4.egg /usr/local/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py:1386: UserWarning: Unbuilt egg for tocmacro [unknown version] (/usr/local/lib/python2.4/site-packages/tocmacro.egg) Environment.add(self,dist) /usr/local/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/package_index.py:155: UserWarning: Unbuilt egg for tocmacro [unknown version] (/usr/local/lib/python2.4/site-packages/tocmacro.egg) Environment.__init__(self,*args,**kw) /usr/local/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py:173: UserWarning: Unbuilt egg for tocmacro [unknown version] (/usr/local/lib/python2.4/site-packages/tocmacro.egg) self.local_index = Environment(self.shadow_path+sys.path) Processing TracTocMacro-184.108.40.206-py2.4.egg Removing /usr/local/lib/python2.4/site-packages/TracTocMacro-220.127.116.11-py2.4.egg Copying TracTocMacro-18.104.22.168-py2.4.egg to /usr/local/lib/python2.4/site-packages TracTocMacro 22.214.171.124 is already the active version in easy-install.pth Installed /usr/local/lib/python2.4/site-packages/TracTocMacro-126.96.36.199-py2.4.egg Processing dependencies for TracTocMacro==188.8.131.52
To be on the safe side I also restarted Apache.
When I now looked in my trac.log file (which is set to DEBUG) I saw that it complained about not having the Genshi Python toolkit. I downloaded and installed version 0.4.1 from their Subversion repository, but now I instead got the following error in my trac.log file:
2007-06-05 15:08:37,679 Trac[loader] DEBUG: Loading egg plugin tractoc.macro from /usr/local/lib/python2.4/site-packages/TracTocMacro-184.108.40.206-py2.4.egg 2007-06-05 15:08:37,693 Trac[loader] ERROR: Failed to load plugin tractoc.macro from /usr/local/lib/python2.4/site-packages/TracTocMacro-220.127.116.11-py2.4.egg Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/trac/loader.py", line 101, in load_components entry_point.load() File "/usr/local/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py", line 1830, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "build/bdist.freebsd-6.2-RELEASE-i386/egg/tractoc/macro.py", line 10, in ? ImportError: cannot import name parse_args
As far as I can see, parse_args is a method on the Python optparse command line parser. And as far as I can see I've also got it installed:
[~]# locate optparse /usr/local/lib/python2.4/optparse.py /usr/local/lib/python2.4/optparse.pyc /usr/local/lib/python2.4/optparse.pyo