2013-04-16 63 views
1

Im新的python和zope。在ZMI我創建了一個新的Python腳本,用下面的代碼:在zope-打印中的python錯誤,但從未讀取'打印'變量

the_message = 'hello there human' 

print the_message 

我無法保存文件,因爲它給出了錯誤「版畫,但從來沒有寫着‘打印’變量」。

如果我使用return the_message那麼它會保存並顯示正常。

有沒有人知道這裏出了什麼問題?有什麼我需要添加到我的腳本,即時消失?

+0

它是Python 3嗎? – Ofiris

+0

@Ofiris:不,python 2,這是Zope。 OP正在討論通過Zope Web服務器編輯的受限制的Python腳本。見http://docs.zope.org/zope2/zope2book/BasicScripting.html#using-python-based-scripts –

+1

@lukeocorn:你是否正在返回'printed'變量? –

回答

2

您需要明確返回printed

the_message = 'hello there human' 

print the_message 

return printed 

printed變量沒有隱含讀取。請參閱Zope 2書籍的基本腳本章節中的Print Statement Support