Graham Dumpleton
graham.dumpleton at gmail.com
Thu Jun 19 23:19:08 EDT 2008
Please use reply-all and keep followups on mailing list. Anyway, read message wrong first time. It isn't log_error() in your code which is problem, but code in mod_python used to display error tracebacks. In particular: tb = traceback.format_exception(etype, evalue, etb) for line in tb: log_error(line[:-1], flags) I can only image that somehow a Unicode character string has gotten into traceback message from Python. What I suggest you do is modify the importer.py in mod_python installed source so that that log_error() call reads: log_error(repr(line[:-1]), flags) That should show you true error which is first occurring. Unicode strings shouldn't be an issue then as are converting it all to displayable latin. Please don't though just fix the error if in your code if obvious, instead post the resultant error traceback to list so can see how unicode string is getting into traceback. Graham 2008/6/20 Mike Landis <mlandis001 at comcast.net>: > Graham, > > The results look identical to me... (see immediately below) > > -Mike > > [Thu Jun 19 22:42:54 2008] [notice] mod_python (pid=3332, > interpreter='localhost'): Importing module 'D:\\htdocs\\Python\\mptest.py' > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] mod_python (pid=3332, > interpreter='localhost', phase='PythonHandler', handler='mptest'): > Application error > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] ServerName: > 'localhost' > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] DocumentRoot: > 'D:/htdocs' > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] URI: > '/Python/mptest.py' > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] Location: None > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] Directory: > 'D:/htdocs/Python/' > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] Filename: > 'D:/htdocs/Python/mptest.py' > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] PathInfo: '' > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] Traceback (most recent > call last): > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] File > "D:\\Programs\\Python25\\lib\\site-packages\\mod_python\\importer.py", line > 1537, in HandlerDispatch\n default=default_handler, arg=req, > silent=hlist.silent) > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] File > "D:\\Programs\\Python25\\lib\\site-packages\\mod_python\\importer.py", line > 1202, in _process_target\n module = import_module(module_name, path=path) > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] File > "D:\\Programs\\Python25\\lib\\site-packages\\mod_python\\importer.py", line > 296, in import_module\n log, import_path) > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] File > "D:\\Programs\\Python25\\lib\\site-packages\\mod_python\\importer.py", line > 680, in import_module\n execfile(file, module.__dict__) > Traceback (most recent call last): > File "D:\Programs\Python25\lib\site-packages\mod_python\importer.py", line > 1784, in ReportError > log_error(line[:-1], flags) > TypeError: argument 1 must be string without null bytes or None, not str > [Thu Jun 19 22:42:54 2008] [error] [client 127.0.0.1] python_handler: > Dispatch() returned non-integer. > ========================================================================== > At 09:33 PM 6/19/2008, you wrote: >> >> What happens when you use: >> >> from mod_python import apache >> apache.log_error('handler') >> >> instead? >> >> Graham >> >> 2008/6/16 Mike Landis <mlandis001 at comcast.net>: >> > >> > 32 bit Windows Vista, Apache 2.2.8, mod_python 3.3.1, python 2.5.2.2 >> > (r252:60911) >> > >> > I received a 500 error from Apache httpd while attempting to get >> > mod_python working on Windows Vista. Following are entries from >> > error.log, httpd.conf, and the Python source (mptest.py) used as a test >> > case. The error >> > occurs within importer.py (part of the mod_pyton site-package). >> > >> > Apache httpd error log: >> > [Sat Jun 14 16:22:29 2008] [notice] mod_python (pid=3708, >> > interpreter='localhost'): Importing module >> > 'D:\\htdocs\\Python\\mptest.py' >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] mod_python >> > (pid=3708, interpreter='localhost', phase='PythonHandler', >> > handler='mptest'): Application error >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] ServerName: >> > 'localhost' >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] DocumentRoot: >> > 'D:/htdocs' >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] URI: >> > '/Python/mptest.py' >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] Location: None >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] Directory: >> > 'D:/htdocs/Python/' >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] Filename: >> > 'D:/htdocs/Python/mptest.py' >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] PathInfo: '' >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] Traceback (most >> > recent call last): >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] File >> > "D:\\Programs\\Python25\\lib\\site-packages\\mod_python\\importer.py", >> > line 1537, in HandlerDispatch\n default=default_handler, arg=req, >> > silent=hlist.silent) >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] File >> > "D:\\Programs\\Python25\\lib\\site-packages\\mod_python\\importer.py", >> > line 1202, in _process_target\n module = import_module(module_name, >> > path=path) >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] File >> > "D:\\Programs\\Python25\\lib\\site-packages\\mod_python\\importer.py", >> > line 296, in import_module\n log, import_path) >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] File >> > "D:\\Programs\\Python25\\lib\\site-packages\\mod_python\\importer.py", >> > line 680, in import_module\n execfile(file, module.__dict__) >> > Traceback (most recent call last): File >> > "D:\Programs\Python25\lib\site-packages\mod_python\importer.py", >> > line 1784, in ReportError log_error(line[:-1], flags) >> > TypeError: argument 1 must be string without null bytes or None, not str >> > [Sat Jun 14 16:22:29 2008] [error] [client 127.0.0.1] python_handler: >> > Dispatch() returned non-integer. >> > >> > -------------------------------------------------------------------------------- >> > httpd.conf entries: >> > LoadModule python_module modules/mod_python.so >> > >> > <Directory D:\htdocs\Python> >> > >> > AddHandler mod_python .py >> > PythonHandler mptest >> > PythonDebug >> > On >> > </Directory> >> > >> > -------------------------------------------------------------------------------- >> > Python source (in mptest.py): >> > >> > from mod_python import apache >> > >> > def handler(req): >> > req.log_error('handler') >> > req.content_type = >> > 'text/plain' >> > req.write('HelloWorld\n') >> > return apache.OK >> > >> > >> > >> >> No virus found in this incoming message. >> Checked by AVG. >> Version: 8.0.100 / Virus Database: 270.4.0/1509 - Release Date: 6/19/2008 >> 8:00 AM > >
|