Odd error by mod_python

charliek fake at example.com
Thu Dec 30 11:02:14 CET 2004

I have mod_python 2.7.10 running with python 2.3.4 and am getting an odd
error.  The error is happening on the production machine, and not on my
development machine.

I am using the publisher handler and am calling the index function with this
from mod_python import apache
import random

def index(req):
    return "hello world"
I am getting the following error:
line 130, in handler
    module = apache.import_module(module_name, _req, [path])

  File "/usr/local/python/lib/python2.3/site-packages/mod_python/apache.py",
line 335, in import_module
    module = imp.load_module(mname, f, p, d)

  File "/var/www/html/test.py", line 2, in ?
    import random

  File "/usr/local/python/lib/python2.3/random.py", line 54, in ?
    LOG4 = _log(4.0)

ValueError: (84, 'Invalid or incomplete multibyte or wide character')

Does anybody know what may cause this?  I have searched the error in google
and have little success.  I am thinking it is some sort of encoding error
or something, but I don't know why this is only happening in production.

Note that this error is only occuring when I import the random module, and
if I comment that out everything works fine.  However I need the random
module for some of my other code.

Also if I run the following from the command line it works fine:
import random
print "hello world"

I don't know if it matters but I am running:
apache 1.3.27
redhat 7.2



More information about the Python-list mailing list