From: Jason Earl <jdearl@yahoo.com>
To: Denis Gasparin <denis@edinet.it>
To: pgsql-interfaces@postgresql.org
Subject: Re: PyGreSQL pg.error Exception
Date: Tue, 3 Jul 2001 11:05:35 -0700 (PDT)
Message-ID: <20010703180535.84694.qmail@web10001.mail.yahoo.com> (raw)
In-Reply-To: <5.1.0.14.0.20010703102711.00ad9d10@10.1.1.2>
Try this:
try:
db = pg.connect(parameters)
except pg.error, error_message
print error_message
I tend to write the except statement a little
differently to remind me that the first parameter to
except is actually expecting a tuple. So instead I
generally write:
except (pg.error,), error_message
Yes, that looks ugly. But two months later I don't
have to look in the info file to see how to call
except.
I hope that is helpful,
Jason
--- Denis Gasparin <denis@edinet.it> wrote:
> Hi to all!
> In the documentation of the PyGreSQL module
> it is said that a
> pg.error exception is thrown when pg.connect or
> other pg functions cause an
> error. How can i get the value of the error? I have
> tried print pg.error in
> the except clause but i get only a _pg.error
> value...
>
> For example:
> try:
> db = pg.connect( connection parameters);
> except pg.error:
> print pg.error;
>
> This prints "_pg.error"...
>
> Thanks in advance for your replies,
>
> Denis
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to majordomo@postgresql.org
> so that your
> message can get through to the mailing list cleanly
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: jdearl@yahoo.com, denis@edinet.it
Subject: Re: PyGreSQL pg.error Exception
In-Reply-To: <20010703180535.84694.qmail@web10001.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox