[mod_python] invalid literal for float

Michael C. Neel neel at mediapulse.com
Tue Oct 21 14:45:49 EST 2003


There's nor really enough info here to see the cause, but it's a MySQLdb
error, not a mod_python error.  Your doesn't show the SQL statement you
are trying to execute, but my guess is that the field in the MySQL table
is defined as a float and your trying to insert a string (the title).
Seeing a few lines of the python module in question would help though.

Mike

> -----Original Message-----
> From: tpc at csua.berkeley.edu [mailto:tpc at csua.berkeley.edu] 
> Sent: Tuesday, October 21, 2003 2:13 PM
> To: mod_python at modpython.org
> Subject: [mod_python] invalid literal for float
> 
> 
> 
> hello all, I am trying to index and search mp3s in my Apache document
> root.  Whenever executing a database select statement that retrieves
> the URL and title (the filename minus the .mp3 extension) of 
> mp3s whose
> filenames contain the words I type into a web form, I get a "invalid
> literal for float" error message.  The same script works fine on the
> command line and in IDLE.  The error messages vary, and I 
> sometimes see
> "invalid literal for int" or "invalid literal for long" though now it
> seems I just get "invalid literal for float."  Also the error seems to
> come and go, and sometimes I get the results I want.  I have 
> gotten this
> type of message before when playing around with Python and trying to
> convert, say, a string to int, but this has me scratching my head:
> 
> Mod_python error: "PythonHandler mod_python.publisher"
> 
> Traceback (most recent call last):
> 
>   File 
> "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 335,
> in HandlerDispatch
>     result = object(req)
> 
>   File 
> "/usr/lib/python2.2/site-packages/mod_python/publisher.py", line
> 194, in handler
>     result = apply(object, (), args)
> 
>   File "/var/www/html/python/temp-invalidtest.py", line 45, in search
>     results = getMP3SearchResults(terms)
> 
>   File "/var/www/html/python/temp-invalidtest.py", line 14, in
> getMP3SearchResults
>     results = getMatchingURLs(cursor)
> 
>   File "/var/www/html/python/temp-invalidtest.py", line 40, in
> getMatchingURLs
>     cursor.execute(sql)
> 
>   File "/usr/lib/python2.2/site-packages/MySQLdb/cursors.py", 
> line 95, in
> execute
>     return self._execute(query, args)
> 
>   File "/usr/lib/python2.2/site-packages/MySQLdb/cursors.py", 
> line 114, in
> _execute
>     self.errorhandler(self, exc, value)
> 
>   File 
> "/usr/lib/python2.2/site-packages/MySQLdb/connections.py", line 33,
> in defaulterrorhandler
>     raise errorclass, errorvalue
> 
> ValueError: invalid literal for float(): <insert any mp3 title here>
> 
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 



More information about the Mod_python mailing list