[Zope] Runtime error in python scripts

Jim Washington jwashin@vt.edu
Thu, 04 Oct 2001 08:23:30 -0400


Harris Peter wrote:

>Hi
>I just got a query from someone testing my Zope application "f2w helpdesk"
>(on sourceforge).
>They got an error in a Python Script:
>
>Error Type: RuntimeError
>Error Value: Script (Python) task_originator_phone has errors.
>
>with the following traceback:
>--------------------------------------------
>Traceback (innermost last):
>  File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 223, in
>publish_module
>[snip... the usual stuff ]
>    (Object: edit_open_request)
>  File /usr/lib/python2.1/site-packages/DocumentTemplate/DT_Util.py, line
>231,
>in eval
>    (Object: task_originator_phone(r_originator))
>    (Info: task_originator_phone)
>  File <string>, line 2, in f
>  File /usr/share/zope/lib/python/Shared/DC/Scripts/Bindings.py, line 324,
>in
>__call__
>    (Object: task_originator_phone)
>  File /usr/share/zope/lib/python/Shared/DC/Scripts/Bindings.py, line 354,
>in
>_bindAndExec
>    (Object: task_originator_phone)
>  File /usr/share/zope/lib/python/Products/PythonScripts/PythonScript.py,
>line
>354, in _exec
>    (Object: task_originator_phone)
>    (Info: ({'script': <PythonScript instance at 88b7548>, 'context':
><r instance at 88ce2f0>, 'container': <Folder instance at 8829200>,
>'traverse_subpath': []}, ('OPSC',), {}, ()))
>RuntimeError: (see above)
>----------------------------------
>They are clearly using Python 2.1, and hence Zope 2.4.  I am using Zope
>2.3.3 on
>Debian, and I can't duplicate the error myself.
>
>What I am asking is, have there been any incompatible changes between Zope
>2.3 and
>Zope 2.4 in the syntax or handling of Python scripts?
>
No, the syntax is not different in this case, but the object code has 
apparently changed from python 1.5.2 to python 2.1.  I have seen this 
several times moving from 2.3.3 to newer zopes.  Usually, one just needs 
to go to the offending python script and submit it to the ZODB again. 
 This forces a recompile and save, which takes care of the vast majority 
of these errors.  

Two things that I have had to watch out for::
string.letters() returns different things in the two pythons.  
Also,  I have seen some weirdness with strftime that I have not got a 
good handle on; it acts like DateTime.strftime() has changed a lot or 
disappeared.  I worked around this by keeping the dates as strings, 
which was OK because I was just storing them in a database anyway.

hth,

--Jim Washington


>