By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,312 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

Odd error by mod_python

P: n/a
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

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.