気づいてはいけなかった

普段、tracは使用していないが、svnとtracで同時に自動生成できるような環境にしてある。
久しぶりに、tracを使おうと思って、アクセスしたはいいが・・・気づいてはいけなかった。

何故か、Internal Server Errorがでる。
エラーを見ると、以下のような表示がされている。

[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] modpython (pid=21054, interpreter='lab.yasuharu.net', phase='PythonHandler', handler='trac.web.modpythonfrontend'): Application error
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] ServerName: 'lab.yasuharu.net'
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] DocumentRoot: '/usr/public/www/lab'
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] URI: '/trac/projectname'
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] Location: '/trac/'
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] Directory: None
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] Filename: '/usr/public/www/lab/trac'
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] PathInfo: '/project
name'
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] Traceback (most recent call last):
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] File "/usr/local/lib/python2.5/site-packages/modpython/importer.py", line 1537, in HandlerDispatch
default=default
handler, arg=req, silent=hlist.silent)
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] File "/usr/local/lib/python2.5/site-packages/modpython/importer.py", line 1229, in _processtarget
result = executetarget(config, req, object, arg)
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] File "/usr/local/lib/python2.5/site-packages/modpython/importer.py", line 1128, in _executetarget
result = object(arg)
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1.ja1-py2.5.egg/trac/web/modpythonfrontend.py", line 143, in handler
reload(sys.modules['trac.web'])
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1.ja1-py2.5.egg/trac/web/
init.py", line 12, in <module>
from trac.web.api import *
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1.ja1-py2.5.egg/trac/web/api.py", line 29, in <module>
from trac.util import get
lasttraceback, md5, unquote
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1.ja1-py2.5.egg/trac/util/
init_.py", line 32, in <module>
from trac.util.html import escape, unescape, Markup, Deuglifier
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1.ja1-py2.5.egg/trac/util/html.py", line 16, in <module>
from genshi import Markup, escape, unescape
[Thu Mar 19 10:53:55 2009] [error] [client 133.51.82.246] ImportError: No module named genshi

genshiがないようだ・・・。
ただ、locateで探してみるとgenshi自体はあった。
そうなると、パスが通ってないことになる。

コンソールから、以下のようにしてパスの一覧を表示させる。

python
import sys
sys.path

実行結果は、以下のようになる。

yasuharu% python
Python 2.5.4 (r254:67916, Feb 24 2009, 16:46:58)
[GCC 4.2.1 20070719 [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg', '/usr/local/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg', '/usr/local/lib/python2.5/site-packages/pytz-2009a-py2.5.egg', '/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1.ja1-py2.5.egg', '/usr/local/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-freebsd-7.0-RELEASE-p7-i386.egg', '/usr/local/lib/python25.zip', '/usr/local/lib/python2.5', '/usr/local/lib/python2.5/plat-freebsd7', '/usr/local/lib/python2.5/lib-tk', '/usr/local/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/local/lib/python2.5/site-packages']

genshiが入っているディレクトリが「/usr/local/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-freebsd-7.0-RELEASE-p2-i386.egg/」となっている。
「/usr/local/lib/python2.5/site-packages」が入っていれば何とかなりそうなんだが・・・。2つ入っているし、よくわからない。

明示的にgenshiのパスを設定することにする。

tracのWebインタフェースから呼び出すときは、mod_pythonを使って呼び出される。
したがって、httpd.confのtracに関するLocationの部分を以下のように変更した。

<Location /trac/>
SetHandler modpython
PythonHandler trac.web.modpython
frontend
PythonOption TracUriRoot "/trac"
PythonOption TracEnvParentDir /hogehoge
PythonPath "sys.path + ['/usr/local/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-freebsd-7.0-RELEASE-p2-i386.egg/']"
</Location>

PythonPathディレクティブにgenshiのパスを付け加えた。
とりあえず、これで、問題ない感じです。また、問題があったら適宜書くことにしよう。

何だかんだで、エラー発生からこの記事を書くまでに45分もかかってしまった・・・。時間が・・・ orz

Posted at : 2009-03-19 11:30:04 / Category : none

Comments

まだコメントはありません / No comment.

Send comment


Name


Mail-address (empty is OK. If you want to notify update, please fill mail-address.)


Bot check code (240425 と入力してください / Please input 240425.)