XMLRPCでハマる…のを助ける

Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/TraM-0.1-py2.5.egg/tram/main.py", line 252, in dispatch_request
    dispatcher.dispatch(req)
  File "/Library/Python/2.5/site-packages/trac/web/main.py", line 206, in dispatch
    req.hdf = HDFWrapper(loadpaths=chrome.get_all_templates_dirs())
  File "/Library/Python/2.5/site-packages/trac/web/chrome.py", line 263, in get_all_templates_dirs
    dirs += provider.get_templates_dirs()
  File "build/bdist.macosx-10.5-ppc/egg/tracrpc/web_ui.py", line 77, in get_templates_dirs
    return [resource_filename(__name__, 'templates')]
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 835, in resource_filename
    self, resource_name
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1305, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1312, in _extract_resource
    manager, os.path.join(zip_path, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1326, in _extract_resource
    self.egg_name, self._parts(zip_path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 915, in get_cache_path
    self.extraction_error()
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 881, in extraction_error
    raise err
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 13] Permission denied: '/Library/WebServer/.python-eggs'

The Python egg cache directory is currently set to:

  /Library/WebServer/.python-eggs

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.

TraMからエラーが出ているからTraMが悪いんじゃないの? という話だったようだけれども,
よく見ればtracrpc辺りが原因であるっぽい.

埒があかなさそうなので,私が引き継いだ.

エラーメッセージ確認と検討

直接の原因が /Library/WebServer/.python-eggs が無いということなのだから,
ちゃらっと

# mkdir /Library/WebServer/.python-eggs
# chown _www:_www /Library/WebServer/.python-eggs

なんてことをすれば簡単に動くような気もする.
けれど,Trac のルートは /Library/WebServer 配下には置いていないので,なんか気持ち悪い.virtual host で運用しているので,何が起こるのかちょっと不安.却下


PYTHON_EGG_CACHE を変更すれば良いかなぁと思いながらweb設定例を検索してみたところ「なんか反映されないんすけど」的なブログが結構あって,却下.

解法

つらつらと,ぐーぐる先生の提案を眺めて,答えらしきブログエントリに遭遇.

# unzip xmlrpcplugin.zip
# easy_install --always-unzip  xmlrpcplugin/trunk/

結局,--always-unzip がキモらしい.
そういや,TracPythonで書かれているのだったっけなぁ.対話処理が必要ではないけれども.

補足

zip/unzip系の変更をアレコレしていると,

ZipImportError: bad local file header in

など言われて慌てる.そんなときはブログエントリにある通り,Webサーバを再起動すればよい