Graham Dumpleton
graham.dumpleton at gmail.com
Fri Jun 20 21:35:50 EDT 2008
2008/6/21 Mike Landis <mlandis001 at comcast.net>: > Graham, > > Here's the error.log entry with the PythonHandler set to mptest. I don't > know how various frameworks work with Apache - the only one that I know for > sure works with WSGI is Web2py and it seems to be fine. Pylons, Django ... > are recommending mod_python. Web2py looks good, but I didn't want the > Apache interface to make the decision for me. All the major frameworks support WSGI, Django, TurboGears, Pylons, CherryPy, web.py and up and comers such as Werkzeug. Although Django may say use mod_python, general consensus is rapidly moving to use of mod_wsgi, it is just that developers who maintain web site haven't decided yet to make a statement that mod_wsgi is equally as capable as mod_python. As to web2py, it would not be one of my first choices. It may be more glitzy and have better marketing speak around it, but having seen some of the code in it and heard various critiques by others about it, I'd be looking elsewhere. I'd probably suggest Django for high level framework and Werkzeug if you want a more low level nuts and bolts approach. Graham > -Mike > [Fri Jun 20 10:02:44 2008] [notice] Parent: Received restart signal -- > Restarting the server. > [Fri Jun 20 10:02:44 2008] [notice] Child 5896: Exit event signaled. Child > process is ending. > [Fri Jun 20 10:02:44 2008] [warn] mod_wsgi: Compiled for Python/2.5. > [Fri Jun 20 10:02:44 2008] [warn] mod_wsgi: Runtime using Python/2.5.2. > [Fri Jun 20 10:02:44 2008] [warn] mod_wsgi: Python module path > 'C:\\Windows\\system32\\python25.zip;D:\\Programs\\Python25\\Lib;D:\\Programs\\Python25\\DLLs;D:\\Programs\\Python25\\Lib\\lib-tk;;D:\\Programs\\Apache > Software Foundation\\Apache2.2\\bin'. > [Fri Jun 20 10:02:45 2008] [notice] Apache/2.2.8 (Win32) DAV/2 PHP/5.2.6 > mod_wsgi/2.0 Python/2.5.2 configured -- resuming normal operations > [Fri Jun 20 10:02:45 2008] [notice] Server built: Jan 18 2008 00:37:19 > [Fri Jun 20 10:02:45 2008] [notice] Parent: Created child process 4356 > [Fri Jun 20 10:02:45 2008] [notice] Child 5896: Released the start mutex > [Fri Jun 20 10:02:45 2008] [error] python_init: Python version mismatch, > expected '2.5', found '2.5.2'. > [Fri Jun 20 10:02:45 2008] [error] python_init: Python executable found > 'D:\\Programs\\Apache Software Foundation\\Apache2.2\\bin\\httpd.exe'. > [Fri Jun 20 10:02:45 2008] [error] python_init: Python path being used > 'C:\\Windows\\system32\\python25.zip;D:\\Programs\\Python25\\Lib;D:\\Programs\\Python25\\DLLs;D:\\Programs\\Python25\\Lib\\lib-tk;;D:\\Programs\\Apache > Software Foundation\\Apache2.2\\bin'. > [Fri Jun 20 10:02:45 2008] [notice] mod_python: Creating 8 session mutexes > based on 0 max processes and 250 max threads. > [Fri Jun 20 10:02:45 2008] [warn] mod_wsgi: Compiled for Python/2.5. > [Fri Jun 20 10:02:45 2008] [warn] mod_wsgi: Runtime using Python/2.5.2. > [Fri Jun 20 10:02:45 2008] [warn] mod_wsgi: Python module path > 'C:\\Windows\\system32\\python25.zip;D:\\Programs\\Python25\\Lib;D:\\Programs\\Python25\\DLLs;D:\\Programs\\Python25\\Lib\\lib-tk;;D:\\Programs\\Apache > Software Foundation\\Apache2.2\\bin'. > [Fri Jun 20 10:02:45 2008] [notice] Child 4356: Child process is running > [Fri Jun 20 10:02:45 2008] [notice] Child 4356: Acquired the start mutex. > [Fri Jun 20 10:02:45 2008] [notice] Child 4356: Starting 250 worker threads. > [Fri Jun 20 10:02:45 2008] [notice] Child 4356: Starting thread to listen on > port 80. > [Fri Jun 20 10:02:46 2008] [notice] Child 5896: All worker threads have > exited. > [Fri Jun 20 10:02:46 2008] [notice] Child 5896: Child process is exiting > [Fri Jun 20 10:02:55 2008] [notice] mod_python (pid=4356, > interpreter='localhost'): Importing module 'D:\\htdocs\\Python\\mptest.py' > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] mod_python (pid=4356, > interpreter='localhost', phase='PythonHandler', handler='mptest'): > Application error > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] ServerName: > 'localhost' > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] DocumentRoot: > 'D:/htdocs' > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] URI: > '/Python/mptest.py' > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] Location: None > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] Directory: > 'D:/htdocs/Python/' > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] Filename: > 'D:/htdocs/Python/mptest.py' > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] PathInfo: '' > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] Traceback (most recent > call last): > [Fri Jun 20 10:02:55 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) > [Fri Jun 20 10:02:55 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) > [Fri Jun 20 10:02:55 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) > [Fri Jun 20 10:02:55 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 > [Fri Jun 20 10:02:55 2008] [error] [client 127.0.0.1] python_handler: > Dispatch() returned non-integer. > > > At 06:01 AM 6/20/2008, Graham Dumpleton wrote: >> >> The HTML output you sent has nothing to do with mptest.py code file, >> it would be for when you have defined: >> >> PythonHandler mod_python.testhandler >> >> You could could use any URL with a .py extension on it and it would do >> this. >> >> If you put it back to: >> >> PythonHandler mptest >> >> does it still fail. If it does, try deleting mptest.py completely and >> start over. Maybe it is some issue with CRLF. >> >> Anyway, as for uninstalling Python, you'll need to wait for someone >> who knows about mod_python on Windows to help. I have run out of >> educated guesses. >> >> BTW, if all you want to do is run Python web applications which >> support WSGI interfaces, eg. Trac, Django etc, maybe you should give >> mod_wsgi a go instead. >> >> Graham >> >> 2008/6/20 Mike Landis <mlandis001 at comcast.net>: >> > Graham, >> > >> > The mod_python package distributed for windows is not an .msi file, so >> > there's no uninstall script auto-generated by windows, but you can (and >> > I >> > did) reinstall the package over the top of the existing install. It >> > produced some errors that I hadn't seen the first time (the original >> > install >> > was error free) - I've attached screen-shots of the errors. >> > >> > The install script allowed me to continue and it seemed to complete >> > despite >> > the errors. I restarted Apache and got lots of output when I pulled up >> > mptest.py in a browser. I attached that output as a .htm file. >> > >> > -Mike >> > >> > At 01:01 AM 6/20/2008, Graham Dumpleton wrote: >> >> >> >> I literally meant to run the 'uninstall' script for mod_python and >> >> Python and run 'install' or 'setup' to reinstall them from scratch. >> >> Not just put back importer.py. >> >> >> >> I have never used mod_python on Windows so not sure about details of >> >> where deinstaller stuff for each will be. Perhaps someone else on list >> >> can say what needs to be done to remove and then reinstall each. >> >> >> >> Graham >> >> >> >> 2008/6/20 Mike Landis <mlandis001 at comcast.net>: >> >> > Graham, >> >> > >> >> > I restored importer.py to its originally distributed state (hope >> >> > that's >> >> > what >> >> > you'd want), made the changes to httpd.conf, restarted Apache, >> >> > reloaded >> >> > mptest.py in the browser (to get mod_python kicked off) and got this: >> >> > >> >> > [Fri Jun 20 00:44:41 2008] [notice] Parent: Received restart signal >> >> > -- >> >> > Restarting the server. >> >> > [Fri Jun 20 00:44:42 2008] [notice] Child 3332: Exit event signaled. >> >> > Child >> >> > process is ending. >> >> > [Fri Jun 20 00:44:42 2008] [warn] mod_wsgi: Compiled for Python/2.5. >> >> > [Fri Jun 20 00:44:42 2008] [warn] mod_wsgi: Runtime using >> >> > Python/2.5.2. >> >> > [Fri Jun 20 00:44:42 2008] [warn] mod_wsgi: Python module path >> >> > >> >> > >> >> > 'C:\\Windows\\system32\\python25.zip;D:\\Programs\\Python25\\Lib;D:\\Programs\\Python25\\DLLs;D:\\Programs\\Python25\\Lib\\lib-tk;;D:\\Programs\\Apache >> >> > Software Foundation\\Apache2.2\\bin'. >> >> > [Fri Jun 20 00:44:42 2008] [notice] Apache/2.2.8 (Win32) DAV/2 >> >> > PHP/5.2.6 >> >> > mod_wsgi/2.0 Python/2.5.2 configured -- resuming normal operations >> >> > [Fri Jun 20 00:44:42 2008] [notice] Server built: Jan 18 2008 >> >> > 00:37:19 >> >> > [Fri Jun 20 00:44:42 2008] [notice] Parent: Created child process >> >> > 7528 >> >> > [Fri Jun 20 00:44:42 2008] [error] python_init: Python version >> >> > mismatch, >> >> > expected '2.5', found '2.5.2'. >> >> > [Fri Jun 20 00:44:42 2008] [error] python_init: Python executable >> >> > found >> >> > 'D:\\Programs\\Apache Software >> >> > Foundation\\Apache2.2\\bin\\httpd.exe'. >> >> > [Fri Jun 20 00:44:42 2008] [error] python_init: Python path being >> >> > used >> >> > >> >> > >> >> > 'C:\\Windows\\system32\\python25.zip;D:\\Programs\\Python25\\Lib;D:\\Programs\\Python25\\DLLs;D:\\Programs\\Python25\\Lib\\lib-tk;;D:\\Programs\\Apache >> >> > Software Foundation\\Apache2.2\\bin'. >> >> > [Fri Jun 20 00:44:42 2008] [notice] mod_python: Creating 8 session >> >> > mutexes >> >> > based on 0 max processes and 250 max threads. >> >> > [Fri Jun 20 00:44:42 2008] [warn] mod_wsgi: Compiled for Python/2.5. >> >> > [Fri Jun 20 00:44:42 2008] [warn] mod_wsgi: Runtime using >> >> > Python/2.5.2. >> >> > [Fri Jun 20 00:44:42 2008] [warn] mod_wsgi: Python module path >> >> > >> >> > >> >> > 'C:\\Windows\\system32\\python25.zip;D:\\Programs\\Python25\\Lib;D:\\Programs\\Python25\\DLLs;D:\\Programs\\Python25\\Lib\\lib-tk;;D:\\Programs\\Apache >> >> > Software Foundation\\Apache2.2\\bin'. >> >> > [Fri Jun 20 00:44:42 2008] [notice] Child 7528: Child process is >> >> > running >> >> > [Fri Jun 20 00:44:43 2008] [notice] Child 7528: Acquired the start >> >> > mutex. >> >> > [Fri Jun 20 00:44:43 2008] [notice] Child 7528: Starting 250 worker >> >> > threads. >> >> > [Fri Jun 20 00:44:43 2008] [notice] Child 3332: Released the start >> >> > mutex >> >> > [Fri Jun 20 00:44:44 2008] [notice] Child 3332: All worker threads >> >> > have >> >> > exited. >> >> > [Fri Jun 20 00:44:44 2008] [notice] Child 3332: Child process is >> >> > exiting >> >> > [Fri Jun 20 00:44:44 2008] [notice] Child 7528: Starting thread to >> >> > listen on >> >> > port 80. >> >> > [Fri Jun 20 00:45:13 2008] [error] make_obcallback: could not call >> >> > init.\n >> >> > Traceback (most recent call last): >> >> > File "D:\Programs\Python25\Lib\site-packages\mod_python\apache.py", >> >> > line >> >> > 937, in init >> >> > from mod_python import importer >> >> > File >> >> > "D:\Programs\Python25\lib\site-packages\mod_python\importer.py", >> >> > line >> >> > 1783 >> >> > for line in tb: >> >> > ^ >> >> > IndentationError: unexpected indent >> >> > [Fri Jun 20 00:45:13 2008] [error] get_interpreter: no interpreter >> >> > callback >> >> > found. >> >> > [Fri Jun 20 00:45:13 2008] [error] [client 127.0.0.1] python_handler: >> >> > Can't >> >> > get/create interpreter. >> >> > >> >> > I also dropped importer.py into a hex editor to see if there was an >> >> > invisible character or something gumming up the works. As far as I >> >> > can >> >> > tell, it looks like standard ASCII - all of the whitespace and >> >> > non-printable >> >> > characters near the 'for line in tb:' are ordinary whitespace: 0x0A, >> >> > 0x09, >> >> > and 0x20 (TAB, LF, and SPACE). >> >> > >> >> > -Mike >> >> > At 12:28 AM 6/20/2008, Graham Dumpleton wrote: >> >> >> >> >> >> Huh, that doesn't quite make sense. Can you replace: >> >> >> >> >> >> PythonHandler mptest >> >> >> >> >> >> with: >> >> >> >> >> >> PythonHandler mod_python.testhandler >> >> >> >> >> >> This will use an inbuilt test handler within mod_python and return a >> >> >> lot of debug if it works. >> >> >> >> >> >> If that still doesn't work, can only suggest uninstalling both >> >> >> Python >> >> >> and mod_python and reinstalling, making sure they are installed as >> >> >> account with Administrator privileges for good measure. >> >> >> >> >> >> Graham >> >> >> >> >> >> 2008/6/20 Mike Landis <mlandis001 at comcast.net>: >> >> >> > Graham, >> >> >> > >> >> >> > I'm sorry, 'line' is defined by the for loop, so you wanted all >> >> >> > three >> >> >> > lines >> >> >> > within the for loop, as follows... >> >> >> > for line in tb: >> >> >> > import sys >> >> >> > print >> sys.stderr, >> >> >> > repr(line[:-1]) >> >> >> > sys.stderr.flush() >> >> >> > log_error(line[:-1], flags) >> >> >> > >> >> >> > that produces: >> >> >> > [Fri Jun 20 00:24:18 2008] [notice] mod_python (pid=3332, >> >> >> > interpreter='localhost'): Importing module >> >> >> > 'D:\\htdocs\\Python\\mptest.py' >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] mod_python >> >> >> > (pid=3332, >> >> >> > interpreter='localhost', phase='PythonHandler', handler='mptest'): >> >> >> > Application error >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] ServerName: >> >> >> > 'localhost' >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] >> >> >> > DocumentRoot: >> >> >> > 'D:/htdocs' >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] URI: >> >> >> > '/Python/mptest.py' >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] Location: >> >> >> > None >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] Directory: >> >> >> > 'D:/htdocs/Python/' >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] Filename: >> >> >> > 'D:/htdocs/Python/mptest.py' >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] PathInfo: '' >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] Traceback >> >> >> > (most >> >> >> > recent >> >> >> > call last): >> >> >> > [Fri Jun 20 00:24:18 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) >> >> >> > [Fri Jun 20 00:24:18 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) >> >> >> > [Fri Jun 20 00:24:18 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) >> >> >> > [Fri Jun 20 00:24:18 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 >> >> >> > import sys >> >> >> > TypeError: argument 1 must be string without null bytes or None, >> >> >> > not >> >> >> > str >> >> >> > [Fri Jun 20 00:24:18 2008] [error] [client 127.0.0.1] >> >> >> > python_handler: >> >> >> > Dispatch() returned non-integer. >> >> >> > >> >> >> > -Mike >> >> >> > At 11:49 PM 6/19/2008, Graham Dumpleton wrote: >> >> >> >> >> >> >> >> Instead of repr(), try str() then. Also try: >> >> >> >> >> >> >> >> line[:-1].encode('UTF-8') >> >> >> >> >> >> >> >> I think. >> >> >> >> >> >> >> >> You might add at same level of indent in that loop: >> >> >> >> >> >> >> >> import sys >> >> >> >> print >> sys.stderr, repr(line[:-1]) >> >> >> >> sys.stderr.flush() >> >> >> >> >> >> >> >> This should hopefully flush out to Apache logs and by pass the >> >> >> >> mod_python error log function. >> >> >> >> >> >> >> >> If still no luck, there may be some issue with Python >> >> >> >> installation, >> >> >> >> not >> >> >> >> sure. >> >> >> >> >> >> >> >> Graham >> >> >> >> >> >> >> >> 2008/6/20 Mike Landis <mlandis001 at comcast.net>: >> >> >> >> > Graham, >> >> >> >> > >> >> >> >> > This result looks similar (if not identical). >> >> >> >> > >> >> >> >> > -Mike >> >> >> >> > >> >> >> >> > [Thu Jun 19 23:41:58 2008] [notice] mod_python (pid=3332, >> >> >> >> > interpreter='localhost'): Importing module >> >> >> >> > 'D:\\htdocs\\Python\\mptest.py' >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] >> >> >> >> > mod_python >> >> >> >> > (pid=3332, >> >> >> >> > interpreter='localhost', phase='PythonHandler', >> >> >> >> > handler='mptest'): >> >> >> >> > Application error >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] >> >> >> >> > ServerName: >> >> >> >> > 'localhost' >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] >> >> >> >> > DocumentRoot: >> >> >> >> > 'D:/htdocs' >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] URI: >> >> >> >> > '/Python/mptest.py' >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] Location: >> >> >> >> > None >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] >> >> >> >> > Directory: >> >> >> >> > 'D:/htdocs/Python/' >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] Filename: >> >> >> >> > 'D:/htdocs/Python/mptest.py' >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] PathInfo: >> >> >> >> > '' >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] Traceback >> >> >> >> > (most >> >> >> >> > recent >> >> >> >> > call last): >> >> >> >> > [Thu Jun 19 23:41:58 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 23:41:58 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 23:41:58 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 23:41:58 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(repr(line[:-1]), flags) >> >> >> >> > # >> >> >> >> > was: >> >> >> >> > log_error(line[:-1], flags) >> >> >> >> > TypeError: argument 1 must be string without null bytes or >> >> >> >> > None, >> >> >> >> > not >> >> >> >> > str >> >> >> >> > [Thu Jun 19 23:41:58 2008] [error] [client 127.0.0.1] >> >> >> >> > python_handler: >> >> >> >> > Dispatch() returned non-integer. >> >> >> >> > >> >> >> >> > At 11:19 PM 6/19/2008, Graham Dumpleton wrote: >> >> >> >> >> >> >> >> >> >> 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 >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> >> >> >> >> >> 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 >> >> >> >> > >> >> >> >> > >> >> >> >> >> >> >> >> 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 >> >> >> > >> >> >> > >> >> >> >> >> >> 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 >> >> > >> >> > >> >> >> >> 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 >> > >> >> No virus found in this incoming message. >> Checked by AVG. >> Version: 8.0.100 / Virus Database: 270.4.1/1510 - Release Date: 6/19/2008 >> 3:21 PM > >
|