Re: [Zope-dev] Problem with Zope 2.6.0 and ZShell

2002-11-19 Thread Guido van Rossum
> On Tue, Nov 19, 2002 at 01:54:56PM -0500, Guido van Rossum wrote:
> > 
> > > 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).
> > ... 
> > 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 0x0202 (or to 0 if
> > you're not sure which Python version you're using) before importing
> > sre for the first time.
> 
> Thanks for your answer.
> 
> Unfortunately I never import sre.
> 
> I import re, then rexec in the main program, 
> then in the restricted code I add the 
> os and os.path modules, and the resticted code
> then import the glob modules and calls its glob
> method.
> 
> So should I set sys.hexversion *before* my re and rexec
> imports in the main program, or add the sys module and
> a fake hexversion value in the restricted code ?

In the restricted code, right at the start.  Restricted code loads its
own copy of each module it uses.  The glob module uses re, which uses
sre.

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

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Problem with Zope 2.6.0 and ZShell

2002-11-19 Thread Jerome Alet
Hi,

On Tue, Nov 19, 2002 at 01:54:56PM -0500, Guido van Rossum wrote:
> 
> > 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).
> ... 
> 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 0x0202 (or to 0 if
> you're not sure which Python version you're using) before importing
> sre for the first time.

Thanks for your answer.

Unfortunately I never import sre.

I import re, then rexec in the main program, 
then in the restricted code I add the 
os and os.path modules, and the resticted code
then import the glob modules and calls its glob
method.

So should I set sys.hexversion *before* my re and rexec
imports in the main program, or add the sys module and
a fake hexversion value in the restricted code ?

thanks in advance

Jerome Alet

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Problem with Zope 2.6.0 and ZShell

2002-11-19 Thread Guido van Rossum
>   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 >= 0x0202:

> 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 0x0202 (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/)

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] Problem with Zope 2.6.0 and ZShell

2002-11-19 Thread Jerome Alet
Hi,

Someone has reported to me a problem when running ZShell's latest 
version (1.5) under Zope 2.6 CVS and Python 2.2.2

Here's the traceback :

*
Traceback (innermost last):
  Module ZPublisher.Publish, line 98, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 39, in call_object
  Module Products.ExternalMethod.ExternalMethod, line 224, in __call__
   - __traceback_info__: ((, ['man ls', 
'ls'], None), {}, (None, None))
  Module /home/zope/Zope/ZInstanceHome/Extensions/zshell.py, line 3501, 
in zshell
  Module /home/zope/Zope/ZInstanceHome/Extensions/zshell.py, line 701, 
in __init__
  Module /home/zope/Zope/ZInstanceHome/Extensions/zshell.py, line 1014, 
in execCommands
  Module /home/zope/Zope/ZInstanceHome/Extensions/zshell.py, line 1081, 
in execCommand
  Module /home/zope/Zope/ZInstanceHome/Extensions/zshell.py, line 891, 
in ShellExpand
  Module rexec, line 429, in s_exec
  Module rexec, line 412, in s_apply
  Module rexec, line 308, in r_exec
  Module __main__, line 1, in ?
  Module rexec, line 339, in r_import
  Module ihooks, line 397, in import_module
  Module ihooks, line 433, in find_head_package
  Module ihooks, line 486, in import_it
  Module ihooks, line 325, in load_module
  Module glob, line 4, in ?
  Module rexec, line 339, in r_import
  Module ihooks, line 397, in import_module
  Module ihooks, line 433, in find_head_package
  Module ihooks, line 486, in import_it
  Module ihooks, line 325, in load_module
  Module fnmatch, line 13, in ?
  Module rexec, line 339, in r_import
  Module ihooks, line 397, in import_module
  Module ihooks, line 433, in find_head_package
  Module ihooks, line 486, in import_it
  Module ihooks, line 325, in load_module
  Module re, line 27, in ?
  Module rexec, line 339, in r_import
  Module ihooks, line 397, in import_module
  Module ihooks, line 433, in find_head_package
  Module ihooks, line 486, in import_it
  Module ihooks, line 325, in load_module
  Module sre, line 168, in ?
AttributeError: 'module' object has no attribute 'hexversion'
*

This seems to be deep in Python standard library.

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

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.

ZShell's latest version is available from :

http://www.librelogiciel.com/software

Thanks in advance for any pointer.

Jerome Alet

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )