Matt McKenna
mmckenna at esri.com
Tue Jul 14 17:19:26 EDT 2009
I am not a programmer but I do want to learn how to create some web apps for use in my admin role at work and I have just started learning Python. I would really appreciate any help with this problem. I am just getting into using python and am trying to setup an apache server to do some web testing and I cannot get past this error. ************************************************************************ **** MOD_PYTHON ERROR ProcessId: 5784 Interpreter: 'localhost' ServerName: 'localhost' DocumentRoot: 'C:/wamp20h/www/' URI: '/test/mptest.py' Location: None Directory: 'C:/wamp20h/www/test/' Filename: 'C:/wamp20h/www/test/mptest.py' PathInfo: '' Phase: 'PythonHandler' Handler: 'mptest' Traceback (most recent call last): File "D:\Python25\Lib\site-packages\mod_python\importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "D:\Python25\Lib\site-packages\mod_python\importer.py", line 1202, in _process_target module = import_module(module_name, path=path) File "D:\Python25\Lib\site-packages\mod_python\importer.py", line 296, in import_module log, import_path) File "D:\Python25\Lib\site-packages\mod_python\importer.py", line 680, in import_module execfile(file, module.__dict__) File "C:\wamp20h\www\test\mptest.py", line 3 def handler(req): ^ IndentationError: unexpected indent MODULE CACHE DETAILS Accessed: Fri Jul 10 16:34:52 2009 Generation: 0 _mp_d776aaec0b7e9783709d848459898c4a { FileName: 'C:\\wamp20h\\www\\test\\mptest.py' Instance: 1 [IMPORT] Generation: 0 [ERROR] Modified: Fri Jul 10 15:36:55 2009 } ************************************************************************ **** I am using a simple index.html to get to mptest.py Content of index.html: <a href="mptest.py">python test</a> Content of mptest.py: from mod_python import apache def handler(req): req.log_error('handler') req.content_type = 'text/plain' req.send_http_header() req.write('mptest.py\n') return apache.OK (I have removed any tab in the code and made sure that there are only 4 spaces before the code lines.) Here is the entry that I have in my httpd.conf file to access the directory where mptest.py lives: <Directory "c:/wamp20h/www/test"> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory> I have the LoadModule line: LoadModule python_module modules/mod_python.so in the httpd.conf file. Here is the contents of my apache_error.log: ************************************************************************ **** Traceback (most recent call last):, referer: http://localhost/test/ File "D:\\Python25\\Lib\\site-packages\\mod_python\\importer.py", line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent), referer: http://localhost/test/ File "D:\\Python25\\Lib\\site-packages\\mod_python\\importer.py", line 1202, in _process_target\n module = import_module(module_name, path=path), referer: http://localhost/test/ File "D:\\Python25\\Lib\\site-packages\\mod_python\\importer.py", line 296, in import_module\n log, import_path), referer: http://localhost/test/ File "D:\\Python25\\Lib\\site-packages\\mod_python\\importer.py", line 680, in import_module\n execfile(file, module.__dict__), referer: http://localhost/test/ File "C:\\wamp20h\\www\\test\\mptest.py", line 3, referer: http://localhost/test/ def handler(req):, referer: http://localhost/test/ ^, referer: http://localhost/test/ IndentationError: unexpected indent, referer: http://localhost/test/ ************************************************************************ **** I am using Apache version 2.2.11 under WAmp Server install. Matthew
|