Odd error by mod_python

C

charliek

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:
----------------------------------------
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 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

Thanks,

Charliek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top