[mod_python] PSP Error & apache.import_module() questions

Peter Sanchez petersanchez at gmail.com
Tue May 9 14:52:37 EDT 2006


Hey all...                                                                                                     
                                                                                                               
I have been getting these errors more and more. I am sure they are                                             
related to my template files, but not sure what the error really means.                                        
Here it is (trimmed):                                                                                          
                                                                                                               
<snip to the meat>                                                                                             
                                                                                                               
PythonHandler mod_python.publisher:   File                                                                     
"/usr/local/lib/python2.4/site-packages/mod_python/psp.py", line 213, in                                       
run\n    exec code in global_scope                                                                             
PythonHandler mod_python.publisher:   File                                                                     
"/home/ahcabron/data/templates/view_img.tmpl", line 160, in ?\n    %>                                          
                                                                                                               
</snip>                                                                                                        
                                                                                                               
Now, line 160 in view_img.tmpl is literally "%>\n" and that's it.                                              
                                                                                                               
I am using mod_python.publisher, and mod_python.psp as my template                                             
engine. Can anyone help me out with this error msg and what it means?                                          
The next line in the traceback can be from any one of my templates, at                                         
various other line numbers. It isn't just in view_img.tmpl, it can be in                                       
any of my templates and always at a line where "%>\n" is all there is.                                         
                                                                                                               
Here is my environment info:                                                                                   
                                                                                                               
Apache/2.0.54 (FreeBSD) PHP/4.4.0 mod_python/3.2.7 Python/2.4.1                                                
                                                                                                               
                                                                                                               
Also, I have a question on the apache.import_module() function. Should                                         
this be done in *all* modules that are subsequently imported. IE                                               
                                                                                                               
index.py imports myconfig.py                                                                                   
myconfig.py in turn imports sys, os and re                                                                     
                                                                                                               
Should myconfig.py be using apache.import_module() as well?                                                    
                                                                                                               
Is there an option to do the equivilent of 'from module import *', etc?                                        
                                                                                                               
Thanks for any help!                                                                                           
                                                                                                               
Peter


More information about the Mod_python mailing list