Bruno Desthuilliers wrote:
> Simon Forman wrote:
> > rodmc wrote:
...
> > except:
> > print "A database connection error has occurred"
>
> How can you assert it is a database connection error ?
assert "database connection" in error
(just kidding)
I was really just leaving as much of the OP's
Simon Forman wrote:
> rodmc wrote:
>
>>Hi,
>>
>>Thanks for your email. Well I am kind of new to exceptions in Python,
>>but here is the code used below, as you can see it is somewhat basic.
>>Is there a way to display more information about the exception?
>>
>>Best,
>>
>>rod
>>
>
>
> Use the tra
for x in range(self.MAX_CRAWL_THREADS+1):
self.con.append(
[MySQLdb.connect(host,username,passwor,database,PORT),0])
PORT is an extra argument you might not have perhaps
rodmc wrote:
> I have written an application that connects to a database on a remote
> machine which uses MySQLdb 1.
Do you have a MySQL acccount set up on the localhost? I usually create
two users with the same privs. One for the localhost where the server
is, another to connect from somewhere else.
Something like
mysql> grant usage on *.* to 'user'@'localhost' identitfied by
'some_pass';
mysql> grant usage on
rodmc wrote:
> Hi,
>
> Thanks for your email. Well I am kind of new to exceptions in Python,
> but here is the code used below, as you can see it is somewhat basic.
> Is there a way to display more information about the exception?
>
> Best,
>
> rod
>
Use the traceback module (See
http://docs.pytho
rodmc wrote:
(top-post corrected)
> Sybren Stuvel wrote:
>
>>rodmc enlightened us with:
>>
>>>--- it refuses to connect on the above line and the exception is
>>>caught and a message displayed.
>>
>>So why do you think this exception and the error message contain
>>no useful information at all
Hi,
Thanks for your email. Well I am kind of new to exceptions in Python,
but here is the code used below, as you can see it is somewhat basic.
Is there a way to display more information about the exception?
Best,
rod
try: #Exception handler for database queries
db = MySQLdb.conn