[mod_python] restricted execution mode and PyXML

Conrad Steenberg conrad at hep.caltech.edu
Sun May 4 00:47:59 EST 2003


Hi

This didn't work for me: on Redhat 9 (which comes with Python 2.2.2) the
only way I could solve the problem was to pre-import the offending files
outside the handler function. E.g. in my case

# Added to avoid the error:
# 'RuntimeError: cannot unmarshal code objects in restricted execution mode'
# That means that other encodings will make the query fail!
mod = __import__('encodings.utf_8',globals(),locals(),'*')
mod = __import__('encodings.utf_16_be',globals(),locals(),'*')

which is a hack since it allows only these two encodings to be used.

If anybody has a better fix, please let me know!

Cheers

Conrad

On Fri, 2003-05-02 at 07:36, Vincent J. Buonassisi wrote:
> hi,
> 
> i had the same problem w/ the same environment (rh 8, python 2.2.1, 
> mod_python 3.0.3, PyXML 0.8.2).  the only way i was able to solve this 
> problem was to install python 2.2.2.
> 
> cheers,
> 
> On Giovedì, mag 1, 2003, at 20:23 US/Pacific, Christopher Blunck wrote:
> 
> > Hi all-
> >
> > Am working with ZSI under mod_python.  The problem I'm
> > running into is that ZSI imports PyXML, which uses
> > dynamic module importing to load encoders for various
> > xml codecs (UTF-8 being the most common encoder).
> > When the PyXML code tries to do the dynamic module
> > import, the Python interpretter prevents it with an
> > error something like "cannot dynamically import module
> > during restricted execution mode".  Forgive me for not
> > quoting the exact error, as I'm currently upgrading
> > the OS on that box right now to RH 9.
> >
> > This occurs with the latest mod_python (3.0.3) with
> > PyXML 0.7.1 and httpd 2.0.40.
> >
> > Has anyone else had success in importing PyXML modules
> > within code run by modpython?
> >
> > Or, does anyone have any information they'd be willing
> > to share to help me out (e.g. "you might try and check
> > out XXX or YYY").  Anything would be useful to me at
> > this point.
> >
> >
> >
> >
> > -c
> >
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Search - Faster. Easier. Bingo.
> > http://search.yahoo.com
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://www.modpython.org/mailman/listinfo/mod_python
> >
> 
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
-- 
Conrad Steenberg <conrad at hep.caltech.edu>



More information about the Mod_python mailing list