[mod_python] encodings (codecs)

Michael Krasnovsky mk at lrn.ru
Sun Aug 18 12:29:34 EST 2002

> Are you sure the version of Python that is being used by mod_python is
> the same as the version that is running from the shell? UTF-8 i one of
> the built-in encodings, so I don't think you'll get exception unless
> the encoding support isn't there at all.

Yes, I'm sure. I have only one version of Python installed - 2.2.1. I
suppose the problem is related somehow to paths resolving during
proceeding my module by mod_python.
But I cannot say how. 
By the way, if I add in sitecustomize.py the line:
sys.path.append('/usr/lib/python2.2/encodings'), I get the next error

  File "/home/mk/tests/biprojects/bisoft/www/test4.py", line 5, in test
    return cnt.encode("utf-8")

  File "/usr/lib/python2.2/encodings/__init__.py", line 51, in
    mod = __import__(modname,globals(),locals(),'*')

  RuntimeError: cannot unmarshal code objects in restricted execution

> FWIW I use this functionality all the time from the Publisher and it
> works fine.

So, may be something wrong in my apache configuration? Could you show
the fragment of your httpd.conf, which  describes mod_python conf.?

Thank you for your help.

More information about the Mod_python mailing list