[Zope-dev] Problem with Zope 2.6.0 and ZShell

Guido van Rossum guido@python.org
Tue, 19 Nov 2002 13:54:56 -0500


>   Module sre, line 168, in ?
> AttributeError: 'module' object has no attribute 'hexversion'
> *****
> 
> This seems to be deep in Python standard library.

Not that deep actually.  sre.py line 168 is this:

    if sys.hexversion >= 0x02020000:

> Since I don't actually use Zope 2.6, does anyone have an idea on 
> where the problem may come from ?

You're using restricted mode (the rexec module) and this apparently
doesn't provide sys.hexversion.  This is a shallow bug; it's already
fixed in Python 2.3 (CVS).

> Does any of you use ZShell with Zope 2.6 ?
> 
> It works fine in 2.5.1 with Python 2.1.3, so something has
> changed somewhere which breaks it.

Probably those versions of Python didn't have the test for
sys.hexversion; it's testing whether this is Python 2.2 or higher.

A workaround would be to set sys.hexversion to 0x02020000 (or to 0 if
you're not sure which Python version you're using) before importing
sre for the first time.

--Guido van Rossum (home page: http://www.python.org/~guido/)