포럼: 도움 (Thread #21325)

UndefinedError: "timedelta" not defined (2009-01-16 14:55 by terasawan #41243)

インストール後、メニューを選択すると
標題のエラーが発生します。
対応方法がお分かりになる方はいらっしゃいますでしょうか?

python:2.3.4
Trac :0.11.ja1
OS  :CentOS release 4.7

本家にも上がってます。
http://trac.edgewall.org/ticket/7669
http://trac.edgewall.org/ticket/7668

RE: UndefinedError: "timedelta" not defined (2009-01-18 13:14 by kabuchan #41269)

一応直したのですが検証できていません
(うちの環境では再現しないので)
コミットしたので確認していただけますか
リビジョン143です

Reply to #41243

RE: UndefinedError: "timedelta" not defined (2009-01-19 09:55 by terasawan #41292)

>kabuchanさん
ご対応ありがとうございます。

早速試させていただいたのですが
残念ながら解決しませんでした。
python2.3.4 固有の問題でしょうか。

下記に、ログを貼付いたします。

2009-01-19 09:54:32,847 Trac[main] ERROR: "timedelta" not defined
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/Trac-0.11.ja1-py2.3.egg/trac/web/main.py", line 424, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.3/site-packages/Trac-0.11.ja1-py2.3.egg/trac/web/main.py", line 220, in dispatch
data, content_type)
File "/usr/lib/python2.3/site-packages/Trac-0.11.ja1-py2.3.egg/trac/web/chrome.py", line 726, in render_template
stream.render(method, doctype=doctype, out=buffer)
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 179, in render
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 61, in encode
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 311, in __call__
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 753, in __call__
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 592, in __call__
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 698, in __call__
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 532, in __call__
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure
File "/usr/lib/python2.3/site-packages/Trac-0.11.ja1-py2.3.egg/trac/web/chrome.py", line 779, in _strip_accesskeys
for kind, data, pos in stream:
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure
File "/usr/lib/python2.3/site-packages/Trac-0.11.ja1-py2.3.egg/trac/web/chrome.py", line 768, in _generate
for kind, data, pos in stream:
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 569, in _include
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 298, in _match
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 298, in _match
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 245, in _match
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 543, in _exec
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 533, in _eval
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 496, in _eval
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 551, in _flatten
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/path.py", line 141, in _generate
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 569, in _include
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 234, in _strip
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 543, in _exec
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 533, in _eval
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 496, in _eval
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 551, in _flatten
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/path.py", line 141, in _generate
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 569, in _include
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 234, in _strip
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 545, in _exec
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 302, in _exec_suite
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/eval.py", line 201, in execute
File "/tmp/.python-eggs/TracGanttCalendarPlugin-0.1_r143-py2.3.egg-tmp/ganttcalendar/templates/gantt.html", line 1, in <Suite u'cur = cur + timedelta(days=1) ...'>
<html xmlns="http://www.w3.org/1999/xhtml"
File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/eval.py", line 279, in _die
UndefinedError: "timedelta" not defined
Reply to #41243

RE: UndefinedError: "timedelta" not defined (2009-01-19 22:25 by kabuchan #41315)

ちゃんと新しいegg拾えてますか?
キャッシュとかeggの参照順とかで古いの見てないですか?


from genshi.template import MarkupTemplate
import datetime
cur = datetime.date(2009,1,19)
aaa = """
<?python
from datetime import timedelta
?>
<p>
<?python
vvv = cur - timedelta(2)
?>
<span>${vvv}</span>
</p>

"""
tmpl = MarkupTemplate( aaa )
stream = tmpl.generate(cur=cur)
print stream.render('xhtml')

これを直接インタプリンタで実行するとどうでしょうか
(ダブルクオートは3連続です)

Reply to #41243

RE: UndefinedError: "timedelta" not defined (2009-01-20 00:59 by kabuchan #41318)

[メッセージ#41315 へのフォロー]
>これを直接インタプリンタで実行するとどうでしょうか

修正できない、、、
インタプリタですね
Reply to #41315

RE: UndefinedError: "timedelta" not defined (2009-01-20 14:37 by terasawan #41327)

>これを直接インタプリンタで実行するとどうでしょうか
<p>
<span>2009-01-17</span>
</p>

と実行結果が返ってきます。

>修正できない、、、
>インタプリタですね
というのは、Python のバージョンを上げてやれば
解決できるのでしょうか?
Reply to #41318

RE: UndefinedError: "timedelta" not defined (2009-01-21 00:45 by kabuchan #41347)

> というのは、Python のバージョンを上げてやれば
> 解決できるのでしょうか?

2.3系でしかでてないみたいなので
2.6か2.5にあげることが可能であれば
それがよいと思います
Reply to #41327

RE: UndefinedError: "timedelta" not defined (2009-01-21 11:22 by kabuchan #41355)

2.3入れてみました
原因わかったので別のスレッドに書きます

(根本的に動作が違うみたいです)
Reply to #41347

RE: UndefinedError: "timedelta" not defined (2009-01-21 15:27 by terasawan #41367)

なるほど。
おとなしくpython2.4 overの環境で試してみます。

わざわざ2.3で試していただいて
ありがとうございます。
Reply to #41355