[lxml-dev] lxml + mod_python: cannot unmarshal code objects in restricted execution mode

Stefan Behnel stefan_ml at behnel.de
Thu Sep 13 18:53:34 CEST 2007


... just forwarding to the list ...

[original mail by Dmitri Fedoruk]


On 9/13/07, Stefan Behnel wrote:
> Looks like you forgot to mention the lxml version you are using.
The most important thing
lxml-1.3.4

> As I already mentioned on c.l.py, you can pass the result of urlopen()
> directly into parse().
Thank you, that looks better.

> Hmmm, I can't see where any "unmarshaling" should be taking place here -
> definitely not in XSLT(). And I don't get why this should only happen once in
> a while.
The point is that it than happens again and again, but I can't see any
regularity. Pretty random.

Here is the real code and it's profiling output:

    try:
        xslt_parser = etree.XMLParser()
        xslt_parser.resolvers.add( PrefixResolver("XSLT") )

        inLogger.log(logging.INFO, "parser created" )

        xslt_doc = etree.parse( urllib2.urlopen(xslt) , xslt_parser)
        inLogger.log(logging.INFO, "%s parsed" % xslt )

        transform = etree.XSLT(xslt_doc)
        inLogger.log(logging.INFO, "xslt transformation created" )

    except Exception, exc:
        inLogger.log(logging.CRITICAL, exc.__str__() )

logging output:
Thu, 13 Sep 2007 19:53:31 INFO parser created
Thu, 13 Sep 2007 19:53:31 INFO http://***/web-out-long.xsl parsed
Thu, 13 Sep 2007 19:53:31 CRITICAL cannot unmarshal code objects in
restricted execution mode

As there is no "xslt transformation created" line, that's why I had to
assume that the error happens in  etree.XSLT .

> Can you figure out what is writing this message? The python interpreter or
> mod_python?
mod_python . The python interpreter runs fine with it, not a single error.

Dmitri


More information about the lxml-dev mailing list