[mod_python] invalid literal for float

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Tue Oct 21 11:12:46 EST 2003

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
    results = getMatchingURLs(cursor)

  File "/var/www/html/python/temp-invalidtest.py", line 40, in

  File "/usr/lib/python2.2/site-packages/MySQLdb/cursors.py", line 95, in
    return self._execute(query, args)

  File "/usr/lib/python2.2/site-packages/MySQLdb/cursors.py", line 114, in
    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>

More information about the Mod_python mailing list