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 Loris Bennett via Python-list
Jon Ribbens writes: > 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.se

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: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Loris Bennett via Python-list
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 read_file() method instead. >> >> As you and