LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-20-2010, 06:48 PM   #1
madsovenielsen
Member
 
Registered: Aug 2009
Posts: 183

Rep: Reputation: 15
mod_python error


Hey all.

I am playing with mod_python.

i have made a hello world program

Code:
<html>
    <head>
        <title>mod_python test</title>
    </head>
    <body>
        <%=print"hello world"%>
    </body>
</html>
And i have added this to my httpd.conf file

Code:
<Directory /absolute/path/to/psp/enabled/dir>
   AddHandler mod_python .psp .psp_
   PythonHandler mod_python.psp
   PythonDebug On
</Directory>
I am getting this error

Code:
MOD_PYTHON ERROR

ProcessId:      21020
Interpreter:    'localhost.localdomain'

ServerName:     'localhost.localdomain'
DocumentRoot:   '/var/www/projects'

URI:            '/test.psp'
Location:       None
Directory:      '/var/www/projects/'
Filename:       '/var/www/projects/test.psp'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'mod_python.psp'

Traceback (most recent call last):

  File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/usr/lib/python2.6/site-packages/mod_python/psp.py", line 336, in handler
    p = PSP(req)

  File "/usr/lib/python2.6/site-packages/mod_python/psp.py", line 119, in __init__
    self.load_from_file()

  File "/usr/lib/python2.6/site-packages/mod_python/psp.py", line 191, in load_from_file
    code = compile(source, filename, "exec")

  File "/var/www/projects/test.psp", line 6

    req.write("""<html>
    <head>
	<title></title>
    </head>
    <body>
	""",0); req.write(str(print"hello world"),0); req.write("""

                      
          
	               
           
          
	                           ^

SyntaxError: invalid syntax
Any help is greatly appriciated

/mads
 
Old 03-21-2010, 05:52 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
A quick guess would say
Code:
<%=print"hello world"%>
should be
Code:
<%=print ("hello world")%>
But i dont about mod_python and i hate python.
 
Old 03-21-2010, 08:41 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
req.write(str(print"hello world"),0);
print is a statement in python 2.x, so you can't use it as if it returns a value.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Embeding mod_python.publisher & mod_python.psp at the same time adilturbo Programming 0 05-22-2009 06:50 AM
mod_python - is there an equivalent to $_SERVER['PHP_SELF'] in mod_python? BrianK Programming 2 04-28-2008 09:46 PM
apache/mod_python problem: ImportError: No module named mod_python.apache BrianK Linux - Software 2 10-10-2007 05:13 PM
mod_python error blong4life Linux - Software 0 06-26-2007 11:15 AM
mod_python config error darthtux Programming 1 05-21-2005 06:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration