Hi there!
A big joint release today. Mostly security fixes but we also have the final
release candidate of 3.13 so let’s start with that!
Python 3.13.0RC2
Final opportunity to test and find any show-stopper bugs before we bless and
release 3.13.0 final on October 1st.
Get it here: Python Releas
Dear all,
unto now I had been thinking this is a wise idiom (in code
that needs not care whether it fails to do what it tries to
do^1):
conn = psycopg2.connection(...)
curs = conn.cursor()
try:
curs.execute(SOME_SQL)
except PSYCOPG2-Exception:
On 07/09/2024 16:48, Karsten Hilbert via Python-list wrote:
Dear all,
unto now I had been thinking this is a wise idiom (in code
that needs not care whether it fails to do what it tries to
do^1):
conn = psycopg2.connection(...)
curs = conn.cursor()
try:
c
Am Sat, Sep 07, 2024 at 09:46:03AM -0700 schrieb Adrian Klaver:
> >unto now I had been thinking this is a wise idiom (in code
> >that needs not care whether it fails to do what it tries to
> >do^1):
> >
> > conn = psycopg2.connection(...)
>
> In the above do you have:
>
> https://www.psycopg.o
Am Sat, Sep 07, 2024 at 01:03:34PM -0700 schrieb Adrian Klaver:
> In the case you show you are doing commit() before the close() so any errors
> in the
> transactions will show up then. My first thought would be to wrap the
> commit() in a
> try/except and deal with error there.
Right, and this
Am Sat, Sep 07, 2024 at 02:09:28PM -0700 schrieb Adrian Klaver:
> >Right, and this was suggested elsewhere ;)
> >
> >And, yeah, the actual code is much more involved :-D
> >
>
> I see that.
>
> The question is does the full code you show fail?
>
> The code sample you show in your original post is
On 8/09/24 9:20 am, Karsten Hilbert wrote:
try:
do something
except:
log something
finally:
.commit()
cadence is fairly Pythonic and elegant in that it ensures the
the .commit() will always be reached regardless of exception