Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro wrote: > On Mon, 9 Sep 2024 09:13:40 - (UTC), Jon Ribbens wrote: >> On 2024-09-08, Lawrence D'Oliveiro wrote: >>> On Sun, 8 Sep 2024 11:03:21 - (UTC), Jon Ribbens wrote: What if there's an exception in your exception handler? I'd put the rollba

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-08, Lawrence D'Oliveiro wrote: > On Sun, 8 Sep 2024 11:03:21 - (UTC), Jon Ribbens wrote: >> What if there's an exception in your exception handler? I'd put the >> rollback in the 'finally' handler, so it's always called. If you've >> already called 'commit' then the rollback does no

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Karsten Hilbert wrote: > Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list: >> So the Python code is half-way through a transaction when it throws >> a (non-database-related) exception and that thread of execution is >> aborted. Th

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro wrote: > On Mon, 9 Sep 2024 10:00:11 - (UTC), Jon Ribbens wrote: >> On 2024-09-09, Lawrence D'Oliveiro wrote: >>> The database only needs to commit when it is explicitly told. Anything >>> less -- no commit. >> >> So the Python code is half-way through a tr

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro wrote: > On Mon, 9 Sep 2024 21:12:51 - (UTC), Jon Ribbens wrote: >> On 2024-09-09, Lawrence D'Oliveiro wrote: >>> On Mon, 9 Sep 2024 10:00:11 - (UTC), Jon Ribbens wrote: On 2024-09-09, Lawrence D'Oliveiro wrote: > The database only needs to com

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-10, Karsten Hilbert wrote: > Am Tue, Sep 10, 2024 at 08:38:30AM - schrieb Jon Ribbens via Python-list: >> Ok. So we've moved away from "In any DBMS worth its salt, rollback is >> something that happens automatically" > > Nope. The original pos

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-10, Lawrence D'Oliveiro wrote: > On Tue, 10 Sep 2024 08:38:30 - (UTC), Jon Ribbens wrote: > >> On 2024-09-09, Lawrence D'Oliveiro wrote: >>> >>> On Mon, 9 Sep 2024 21:12:51 - (UTC), Jon Ribbens wrote: On 2024-09-09, Lawrence D'Oliveiro wrote: > > On Mon, 9 Se

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-11 Thread Jon Ribbens via Python-list
On 2024-09-11, Lawrence D'Oliveiro wrote: > On Tue, 10 Sep 2024 22:48:36 - (UTC), Jon Ribbens wrote: >> But what if you tell it the wrong thing ... > > To get back to the original point of this thread, all that rigmarole to > try to ensure to call “rollback” in case of an exception is complet

Re: Correct syntax for pathological re.search()

2024-10-08 Thread Jon Ribbens via Python-list
On 2024-10-07, Stefan Ram wrote: > "Michael F. Stemper" wrote or quoted: >>For now, I'll use the "r" in a cargo-cult fashion, until I decide which >>syntax I prefer. (Is there any reason that one or the other is preferable?) > > I'd totally go with the r-style notation! > > It's got one bumme

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-29 Thread Jon Ribbens via Python-list
On 2024-10-29, Loris Bennett wrote: > Hi, > > With Python 3.9.18, if I do > > try: > with open(args.config_file, 'r') as config_file: > config = configparser.ConfigParser() > config.read(config_file) > print(config.sections()) > > i.e try to read the

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Jon Ribbens via Python-list
On 2024-10-30, Loris Bennett wrote: > Jon Ribbens writes: >> As per the docs you link to, the read() method only takes filename(s) >> as arguments, if you have an already-open file you want to read then >> you should use the read_file() method instead. > > As you and others have pointed out, this

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Jon Ribbens via Python-list
On 2024-10-30, Loris Bennett wrote: > Jon Ribbens writes: >> On 2024-10-30, Loris Bennett wrote: >>> Jon Ribbens writes: As per the docs you link to, the read() method only takes filename(s) as arguments, if you have an already-open file you want to read then you should use the r

Re: Printing UTF-8 mail to terminal

2024-11-02 Thread Jon Ribbens via Python-list
On 2024-11-01, Eli the Bearded <*@eli.users.panix.com> wrote: > In comp.lang.python, Gilmeh Serda wrote: >> Python 3.12.6 (main, Sep 8 2024, 13:18:56) [GCC 14.2.1 20240805] on linux >> Type "help", "copyright", "credits" or "license" for more information. >> >>> help('modules') >> >> Please wai

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-31 Thread Jon Ribbens via Python-list
On 2024-10-31, Loris Bennett wrote: > Jon Ribbens writes: >> On 2024-10-30, Loris Bennett wrote: >>> Jon Ribbens writes: On 2024-10-30, Loris Bennett wrote: > Jon Ribbens writes: >> As per the docs you link to, the read() method only takes filename(s) >> as arguments, if you

Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-14 Thread Jon Ribbens via Python-list
On 2024-11-14, Michael Torrie wrote: > On 11/14/24 12:03 AM, Left Right wrote: >>> On any Unix system this is untrue. Rotating a log file is quite simple: >> >> I realized I posted this without cc'ing the list: >> http://jdebp.info/FGA/do-not-use-logrotate.html . >> >> The link above gives a mo

<    1   2   3