[mod_python] Dies on Database connection?

Ross Karchner ross at karchner.com
Thu Jan 22 21:42:42 EST 2004


As much as I'd *love* to follow this particular rabbit down this 
particular hole...

I got it working! I installed the Apache2 and ModPython3 from the 
FreeBSD ports, moved over my apache configuration, and IT WORKS.

Thank you, Michael, Petron, Manfred, and Oliver!

Now that things are working, I look forward to bugging you all with 
more questions in the future ;)

-Ross

On Jan 22, 2004, at 9:26 PM, Michael C. Neel wrote:

> I had mentioned this prior on these odd mysql issues, and not see 
> anyone
> go down this road, but the string part now give more credence to this
> being the cause.
>
> There are some posts that point to MySQLdb having issue with locale
> settings, and it surfaced in the float on a string error being thrown.
> I've only played with the locale module in passing, so how python
> handles locales and unicode as well, which could be a cause here to.  
> At
> least if it was my system with this issue I'd go down this road =)
>
> Mike
>
>> -----Original Message-----
>> From: mod_python-bounces at modpython.org
>> [mailto:mod_python-bounces at modpython.org] On Behalf Of Ross Karchner
>> Sent: Thursday, January 22, 2004 8:13 PM
>> To: Mod_python at modpython.org
>> Subject: Re: [mod_python] Dies on Database connection?
>>
>>
>> On Jan 22, 2004, at 5:46 PM, Petros Keshishian wrote:
>>> Try to see whether your script works when you query
>>> only one column. I am very intersted in the solution
>>> of this problem.
>>
>> YES! Thank you-
>>
>> This is the same behavior.  If I change the query to only select one
>> field, it works fine.
>>
>> If it's a number...
>>
>> As if things couldn't get stranger...
>>
>> This works fine: C.execute('select id from cities where id=17;')
>> (id is an integer)
>> But this:
>> C.execute('select place from cities where id=17;')
>> (place is a string)
>> Throws:
>> Mod_python error: "PythonHandler mod_python.publisher"
>>
>> Traceback (most recent call last):
>>
>>    File
>> "/usr/local/lib/python2.3/site-packages/mod_python/apache.py",
>> line 332, in HandlerDispatch
>>      result = object(req)
>>
>>    File
>> "/usr/local/lib/python2.3/site-packages/mod_python/publisher.p
>> y", line
>> 198, in handler
>>      result = apply(object, (), args)
>>
>>    File "/usr/home/localfeeds/htdocs/near/display-rss.py",
>> line 19, in
>> index
>>      C.execute('select place from cities where id=17;')
>>
>>    File "/usr/local/lib/python2.3/site-packages/MySQLdb/cursors.py",
>> line 95, in execute
>>      return self._execute(query, args)
>>
>>    File "/usr/local/lib/python2.3/site-packages/MySQLdb/cursors.py",
>> line 114, in _execute
>>      self.errorhandler(self, exc, value)
>>
>>    File
>> "/usr/local/lib/python2.3/site-packages/MySQLdb/connections.py",
>> line 33, in defaulterrorhandler
>>      raise errorclass, errorvalue
>>
>> ValueError: invalid literal for float(): New York
>>
>> What on earth could be trying to mangle the results of the
>> query into a
>> float? The traceback makes it pretty clear that this error
>> happens when
>> the query is executed.
>>
>> The rest of Localfeeds.com  does a similar query thousands of times a
>> day from Python CGI scripts. Same Python, same MySQLdb module, same
>> everything.
>>
>> Right now, I am going to see if I have better luck with the
>> Apache and
>> mod_python from the FreeBSD ports system
>>
>> -Ross
>>
>>
>> _______________________________________________
>> 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