[mod_python] invalid literal for float solved addendum

Michael C. Neel neel at mediapulse.com
Mon Oct 27 19:04:11 EST 2003


> 	sql = """SELECT title, url FROM URLs, URLs_WITH_MATCHES WHERE
> URLs.id = URLs_WITH_MATCHES.url_id;"""
> 	cursor.execute(sql)

I find it hard to believe that this is somehow a mod_python problem.
Are you running the latest version of MySQLdb?  I have used mod_python +
MySQLdb on well over 10 sites now for clients (more for my own sites)
and never ran into trouble; an error this basic I think would have shown
itself by now.

>From the traceback you can see that MySQLdb is throwing the execption,
and if you look at the lines in cursors.py it lists you can see that a
try block is pretty much wrapping the work done.  I'd try to go in and
comment out some of those try blocks and also place an assert here and
there to see what's really happening (fyi you can do an assert 0,
varname and get a traceback with the value of varname - quick trick to
help debug something).

Did you ask on the MySQLdb forums?  I looked at sf and didn't see it.  A
search in google showed some others with this issue, one related to the
locale not being US and another with a broken python install.  Remember
that the python you run at command line is not the same one you run
under mod_python, so if the python mod_pyhton is using is setup
differently and/or broken from the python binary that would explain why
it works in cgi (which exec's the python binary).

Mike



More information about the Mod_python mailing list