[mod_python] Mod_python error...

Rich Pinder rpinder at usc.edu
Tue Nov 15 16:06:19 EST 2005


Dont ya hate it... something that USED to work fine......

Long ago I got a script working with Apache 1.x, Firebird (via 
kinterbasdb module)......
And today, although my script actually succeeds updating my database, 
instead of seeing the nice little 'thank you' message I get the 
following error message.
Its one of those  'DAMN... I dont think I've changed anything'  
moments...  and I've pretty much forgotten the in's and out's of why and 
how this little scripting works !

Could you help me decipher where I should start looking here ??    (mail 
/ postfix seem to be working from this machine just fine)

Thanks
Rich Pinder
USC School of Medicine

The error:

>Mod_python error: "PythonHandler mod_python.publisher"
>
>Traceback (most recent call last):
>
>  File "/usr/lib/apache/lib/python2.2/site-packages/mod_python/apache.py", line 193, in Dispatch
>    result = object(req)
>
>  File "/usr/lib/apache/lib/python2.2/site-packages/mod_python/publisher.py", line 171, in handler
>    result = apply(object, (), args)
>
>  File "/home/httpd/htdocs/ctspython/ctsform.py", line 54, in sendinfo
>    conn = smtplib.SMTP("email.usc.edu")
>
>  File "/usr/lib/python2.2/smtplib.py", line 234, in __init__
>    (code, msg) = self.connect(host, port)
>
>  File "/usr/lib/python2.2/smtplib.py", line 269, in connect
>    for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
>
>gaierror: (-2, 'Name or service not known')
>

The module:

> import smtplib, kinterbasdb, string
> def sendinfo(frm_First, frm_Last, frm_RespType, frm_Id, frm_Email, 
> frm_Phone, frm_Text):
>
>  TABLE_NAME = 'xxxxx'
>
>
>  con = kinterbasdb.connect(
>          dsn="/home/xxx/xxx.gdb",
>          user="xxx",
>          password="xxxpw"
>                 )
>
>
>  cur = con.cursor()
>
>  frm_Text = frm_Text[0:1000]
>
>  newContact = (
>           (frm_First, frm_Last, frm_RespType, frm_Id, frm_Email, 
> frm_Phone, frm_Text))
>
>
>
>  cur.execute("insert into ctscontact(fn, ln, resptype, id, email, 
> phone, sugg) values (?, ?, ?, ?, ?, ?, ?)", newContact)
>
>  con.commit()
>
>
>
>     # create the message text
>
>  msg = """\
> From: %s
> Subject: feedback
> To: webmaster
>
> I have the following comment:
>
> %s
>
> Thank You,

>
> %s
>
> """ % (frm_Email, frm_Text, frm_First)
>
>     # send it out
>  conn = smtplib.SMTP("email.xxx.com")
>  conn.sendmail("xxx at xxx.com", "xxx at xxx.com", "Subject : Email recieved")
>  conn.quit()
>
>     # provide feedback to the user
>  s = """\
>  <html>
>
> <BODY BGCOLOR=#DBE7F3></BODY>
> <META HTTP-EQUIV="Refresh" 
> CONTENT="2;URL=https://www.calteachersstudy.org">
>
>  Dear %s,<br>
>
>  Thank You for your comments, we
>  will get back to you shortly.<br><br>
>
>  Returning to home page....
>
>  </html>""" %frm_First
>
>  return s






More information about the Mod_python mailing list