[mod_python] odd error : Invalid or incomplete multibyte or wide character

charlie knudsen charlie at cknudsen.net
Thu Dec 30 20:02:36 EST 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
code:
----------------------------------
from mod_python import apache
import random

def index(req):
    return "hello world"
--------------------------------------
I am getting the following error sent to the browser (with debugging on):
----------------------------------------
 Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/local/python/lib/python2.3/site-packages/mod_python/apache.py", 
line 193, in Dispatch
    result = object(req)

  File 
"/usr/local/python/lib/python2.3/site-packages/mod_python/publisher.py", 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 via google
and have little success.  I am thinking it is some sort of encoding error, but 
I don't know why this is only happening in production.  I have tried to use 
the random.py file that is on my development machine, but this did not change 
anything.

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, and used this as a minimal example.

Also I am able to "import random" on the python command line with no problems.

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

Thanks,

Charlie



More information about the Mod_python mailing list