Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

A long-forgotten loved one will appear soon. Buy the negatives at any price.


comp / comp.lang.python / Re: FileNotFoundError thrown due to file name in file, rather than file itself

SubjectAuthor
* Re: FileNotFoundError thrown due to file name in file, rather than file itselfCameron Simpson
`* Re: FileNotFoundError thrown due to file name in file, rather than file itselfLoris Bennett
 +- Re: FileNotFoundError thrown due to file name in file, rather than file itselfKarsten Hilbert
 `- Re: FileNotFoundError thrown due to file name in file, rather than file itselfRob Cliffe

1
Subject: Re: FileNotFoundError thrown due to file name in file, rather than file itself
From: Cameron Simpson
Newsgroups: comp.lang.python
Date: Mon, 11 Nov 2024 21:17 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: FileNotFoundError thrown due to file name in file, rather than
file itself
Date: Tue, 12 Nov 2024 08:17:46 +1100
Lines: 41
Message-ID: <mailman.94.1731359879.4695.python-list@python.org>
References: <26418.15836.335097.984240@ixdm.fritz.box>
<ZzJ0eoWZds3xSKWn@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de MO7U7ow8q/qHv68/pzlk9g2x+SkTUAGdMl7ffe9rp16g==
Cancel-Lock: sha1:j3ajq3R70xUsA6vE3arMIXqyjvA= sha256:JoiI5fYMNa0SjXdbMDktPxYEKKsDk/RuYIB/dZrmBTU=
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.009
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:name': 0.07;
'(python': 0.09; 'cc:addr:python-list': 0.09; 'cheers,': 0.11;
'log': 0.12; 'cc:no real name:2**0': 0.14; 'bennett': 0.16;
'cameron': 0.16; 'found.': 0.16; 'found:': 0.16; 'from:addr:cs':
0.16; 'from:addr:cskk.id.au': 0.16; 'from:name:cameron simpson':
0.16; 'generating': 0.16; 'message-id:@cskk.homeip.net': 0.16;
'program:': 0.16; 'received:13.237': 0.16; 'received:13.237.201':
0.16; 'received:13.237.201.189': 0.16; 'received:cskk.id.au':
0.16; 'received:id.au': 0.16; 'received:mail.cskk.id.au': 0.16;
'simpson': 0.16; 'wrote:': 0.16; 'code.': 0.19;
'cc:addr:python.org': 0.20; 'exception': 0.22; 'subject:file':
0.22; 'cc:2**1': 0.23; 'code': 0.23; 'skip:{ 20': 0.26; 'error':
0.29; 'header:User-Agent:1': 0.30; 'header:In-Reply-To:1': 0.34;
'fine': 0.35; 'received:au': 0.35; 'following': 0.35; '...': 0.37;
'file': 0.38; 'way': 0.38; 'put': 0.38; 'quite': 0.39; 'wrote':
0.39; 'file:': 0.40; 'learn': 0.40; 'should': 0.40; 'likely':
0.61; 'between': 0.63; 'your': 0.64; 'full': 0.64; 'received:13':
0.64; 'well': 0.65; 'received:userid': 0.66; 'generally': 0.67;
'terms': 0.69; 'piece': 0.69; 'raised': 0.70; 'clause': 0.84;
'so:': 0.84; 'subject: \n ': 0.84; 'subject:than': 0.91
Mail-Followup-To: dieter.maurer@online.de,
Loris Bennett <loris.bennett@fu-berlin.de>, python-list@python.org
Content-Disposition: inline
In-Reply-To: <26418.15836.335097.984240@ixdm.fritz.box>
User-Agent: Mutt/2.2.13 (2024-03-09)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <ZzJ0eoWZds3xSKWn@cskk.homeip.net>
X-Mailman-Original-References: <26418.15836.335097.984240@ixdm.fritz.box>
View all headers

On 11Nov2024 18:24, dieter.maurer@online.de <dieter.maurer@online.de> wrote:
>Loris Bennett wrote at 2024-11-11 15:05 +0100:
>>I have the following in my program:
>> try:
>> logging.config.fileConfig(args.config_file)
>> config = configparser.ConfigParser()
>> config.read(args.config_file)
>> if args.verbose:
>> print(f"Configuration file: {args.config_file}")
>> except FileNotFoundError:
>> print(f"Error: configuration file {args.config_file} not found. Exiting.")
>
>Do not replace full error information (including a traceback)
>with your own reduced error message.
>If you omit your "try ... except FileNotFoundError`
>(or start the `except` clause with a `raise`), you
>will learn where in the code the exception has been raised
>and likely as well what was not found (Python is quite good
>with such error details).

Actually, file-not-found is pretty well defined - the except action
itself is fine in that regard.

[...]
>>2. In terms of generating a helpful error message, how should one
>> distinguish between the config file not existing and the log file not
>> existing?

Generally you should put a try/except around the smallest possible piece
of code. So:

config = configparser.ConfigParser()
try:
config.read(args.config_file)
except FileNotFoundError as e:
print(f"Error: configuration file {args.config_file} not found: {e}")

This way you know that the config file was missing.

Cheers,
Cameron Simpson <cs@cskk.id.au>

Subject: Re: FileNotFoundError thrown due to file name in file, rather than file itself
From: Loris Bennett
Newsgroups: comp.lang.python
Organization: FUB-IT, Freie Universität Berlin
Date: Tue, 12 Nov 2024 08:52 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: loris.bennett@fu-berlin.de (Loris Bennett)
Newsgroups: comp.lang.python
Subject: Re: FileNotFoundError thrown due to file name in file, rather than file itself
Date: Tue, 12 Nov 2024 09:52:31 +0100
Organization: FUB-IT, Freie Universität Berlin
Lines: 70
Message-ID: <87o72kygts.fsf@zedat.fu-berlin.de>
References: <26418.15836.335097.984240@ixdm.fritz.box>
<ZzJ0eoWZds3xSKWn@cskk.homeip.net>
<mailman.94.1731359879.4695.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: news.uni-berlin.de lnHrB1YVJ3idx1xFigXW4gWV+uy6MkIGAYNKVbhIEcwOIX
Cancel-Lock: sha1:Ee5tD5KKtlIZJXE4P2TyvGh6Cy0= sha1:j+dkuimdMFTWOzZxhapLQ8+WFvw= sha256:QrmfJxqK49FmJ5oUvNgdcix0tNL9UvEMFd94edt2cNU=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
View all headers

Cameron Simpson <cs@cskk.id.au> writes:

> On 11Nov2024 18:24, dieter.maurer@online.de <dieter.maurer@online.de> wrote:
>>Loris Bennett wrote at 2024-11-11 15:05 +0100:
>>>I have the following in my program:
>>> try:
>>> logging.config.fileConfig(args.config_file)
>>> config = configparser.ConfigParser()
>>> config.read(args.config_file)
>>> if args.verbose:
>>> print(f"Configuration file: {args.config_file}")
>>> except FileNotFoundError:
>>> print(f"Error: configuration file {args.config_file} not found. Exiting.")
>>
>>Do not replace full error information (including a traceback)
>>with your own reduced error message.
>>If you omit your "try ... except FileNotFoundError`
>>(or start the `except` clause with a `raise`), you
>>will learn where in the code the exception has been raised
>>and likely as well what was not found (Python is quite good
>>with such error details).
>
> Actually, file-not-found is pretty well defined - the except action
> itself is fine in that regard.
>
> [...]
>>>2. In terms of generating a helpful error message, how should one
>>> distinguish between the config file not existing and the log file not
>>> existing?
>
> Generally you should put a try/except around the smallest possible
> piece of code. So:
>
> config = configparser.ConfigParser()
> try:
> config.read(args.config_file)
> except FileNotFoundError as e:
> print(f"Error: configuration file {args.config_file} not found: {e}")
>
> This way you know that the config file was missing.

I appreciate the point you make about the smallest possible piece of
code, although I can imagine that this could potentially create a lot of
try/except clutter and I might just want a single block and then try to
catch various exceptions.

Regarding your example above, if 'missingfile.py' contains the following

import configparser

config = configparser.ConfigParser()

try:
config.read('/foo/bar')
except FileNotFoundError as e:
print(f"Error: configuration file {config_file} not found: {e}")

them

python3 missingfile.py

does not produce an any output for me and so does not seem to be a
reliable way of handling the case where the config file does not exist.

Cheers,

Loris

--
This signature is currently under constuction.

Subject: Re: FileNotFoundError thrown due to file name in file, rather than file itself
From: Karsten Hilbert
Newsgroups: comp.lang.python
Date: Tue, 12 Nov 2024 17:47 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!border-4.nntp.ord.giganews.com!border-3.nntp.ord.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!not-for-mail
From: Karsten.Hilbert@gmx.net (Karsten Hilbert)
Newsgroups: comp.lang.python
Subject: Re: FileNotFoundError thrown due to file name in file, rather than
file itself
Date: Tue, 12 Nov 2024 18:47:37 +0100
Lines: 46
Sender: <karsten.hilbert@gmx.net>
Message-ID: <mailman.99.1731433661.4695.python-list@python.org>
References: <26418.15836.335097.984240@ixdm.fritz.box>
<ZzJ0eoWZds3xSKWn@cskk.homeip.net>
<mailman.94.1731359879.4695.python-list@python.org>
<87o72kygts.fsf@zedat.fu-berlin.de>
<ZzOUuVy6s0Ao3ZKq@hermes.hilbert.loc>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de mqu3KSmafezqV4T9fE8+RArCKkBLAMTpNb2lNTiwAEqQ==
Cancel-Lock: sha1:49hFnvqDb9CsQZMbb/NuCuWCj6Q= sha256:bPbR+HoDU/KvhhKO9+xDabs5sMWtJ+do2433Zc3CmXs=
Return-Path: <karsten.hilbert@gmx.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmx.net header.i=karsten.hilbert@gmx.net
header.b=WQn7gFqq; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(e.g.': 0.05;
'received:212.227': 0.07; 'subject:name': 0.07; 'gpg': 0.09;
'karsten': 0.09; 'parse': 0.09; 'schrieb': 0.09; 'well:': 0.09;
'import': 0.15; '1713': 0.16; 'bennett': 0.16; 'directory,': 0.16;
'filename': 0.16; 'found:': 0.16; 'given.': 0.16; 'instance':
0.16; 'iterable': 0.16; 'python3': 0.16; 'specify': 0.16; 'to:addr
:python-list': 0.20; 'returns': 0.22; 'subject:file': 0.22;
'cannot': 0.25; '>>>': 0.28; 'fact': 0.28; 'output': 0.28;
'error': 0.29; 'seem': 0.31; 'module': 0.31; 'tue,': 0.31;
'empty': 0.32; 'header:In-Reply-To:1': 0.34; 'handling': 0.35;
'following': 0.35; 'files': 0.36; "skip:' 10": 0.37; 'example':
0.37; 'file': 0.38; 'way': 0.38; 'read': 0.38; 'list': 0.39;
'single': 0.39; 'files.': 0.40; 'potential': 0.60; 'method': 0.61;
'skip:h 10': 0.61; 'your': 0.64; 'produce': 0.65; 'above,': 0.70;
'knowing': 0.71; 'reliable': 0.74; 'subject: \n ': 0.84;
'subject:than': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net;
s=s31663417; t=1731433658; x=1732038458; i=karsten.hilbert@gmx.net;
bh=NpXcUG9GVOihKcgcQbYyjVSY5SVaZk3AMsMhlYXIgS0=;
h=X-UI-Sender-Class:Date:From:To:Subject:Message-ID:References:
MIME-Version:Content-Type:In-Reply-To:Content-Transfer-Encoding:
cc:content-transfer-encoding:content-type:date:from:message-id:
mime-version:reply-to:subject:to;
b=WQn7gFqqHqvijM5XmRc9Afij1RWGSsevJW1ACM6o7zupahqvFx3qpzF4AXY/VAoj
QzZdOFMAu27muqUfaRBMyXuQuouB8C+of34GwLjHjwtdTQwkieWbS7BexqaOyK6Vq
CXlR62ojn+s/UeKn+xQfxxKkx31MmyGoQErMeXp123k3gNjW7SI72atnD9RMqbtjR
qQ0w/hS5PzRqZEmaIxKC0o7lbyE9OYsvav+TXMa2Odt9mZ9eRqjzRKzisgMs0OjI2
H5VTTeZsoNIFzPU1wZDnIIHUhTgHH+SgEnYG9x9Ipjw5jnfUV7cLzxldw40geghl0
6u1ne0zQR7IBNheeSg==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Content-Disposition: inline
In-Reply-To: <87o72kygts.fsf@zedat.fu-berlin.de>
Ma_X_il-Followup-to: d
Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net
Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net
X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net
X-Pri_X_ority: 2 (High)
X-Provags-ID: V03:K1:Q/beD+w1V11oQ9dK9ovu4yrjY+ZFdaGlHeq57SE57ZpMOd3TNP2
jM6VEtFx2JyCLChXfKc4flIisHoT/g3DBOlu2uly8K6ShDRXOLn8lfrageogjG4QUT6/WXj
sfCgeAPOyKdlSB17KwS9g2DwunsgIPfw/0L2Ph+kmpxKBFcHgTvZhXBO8KHG7ebpECFrxh2
Lu0XwlDPBrbvxEDOclaUQ==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:Ia1h/dF5uTI=;U88P3QD9hLeR2kiyDxNUHIJZl8W
DJxw7Zz0RW00kwA+AQKoMA7KK5wyK3g4QjNu+9MhIm3hpBcDmObOi4kAuqzS31Tj/Qin3hzJH
tZMuBQyLPAX7Nwlu5M+78eLUPMtkC1fc1IO68QYhKF3icyIx/+fUKot3tHSZ5QUgu+ADifPy4
1rdISaRjxtS24ezp/XXuucwV9IVLwe1iE2yxfVA/wIvYLZVPC2JSwJGAi9l2xRUA1RD1op/ou
kCS++q5WCZtxGuVUeW/4d9xuz/m1Yj2h4By2BEd7+YzqOrryFU4K9/AdCUNJD257xFv5LPCqy
GOY7St/Vks0+ZTxuCaN9yaoGTKLm7taXk7rEl7pprmjsrzo8BNlwuxTGRy3a+1i3JGhbR8WZF
fLMueAZ/+8ETM+KfbankfDKvF0BAmsl4XeYwHnpyo0r4LOiKk58Yy1nCl/4EpsF4yqTJooIsa
4532JMVIRRl95cXUXstjfBHBBiQNSixp3hrWXYhqEJRi6mIn5xZHpOBflkXSlrKDrAniFrAiA
S2opS9dXBSlQ89I81VgzyR5uRSO9sOcbkK1FgrDxdIy3ClzMoNy8T7D58ZAP0tJ1f3/fTzBl9
Bton5Ve5dMr6S7IAVwV4MNaeit/PlylX/yNS/l6JqxgSiN9SAQ7uvlHfaWCRiEkNwY+kirjTG
7th3Uek3YwdaZdXEea1+E6zLMcsRtlgkDr5X/z+m5rz1U0sE/FzE74BMOgWoknSdIlfZfpFES
BchhCAPYMwnl7BqFxH/i2g3M/onBQBEkPrKScVkVDH5kubdrryGU1iznJ3iTZeeFJqNRe1+cq
cHqdUfvyxd/6MzH/KTOf+cKQ==
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <ZzOUuVy6s0Ao3ZKq@hermes.hilbert.loc>
X-Mailman-Original-References: <26418.15836.335097.984240@ixdm.fritz.box>
<ZzJ0eoWZds3xSKWn@cskk.homeip.net>
<mailman.94.1731359879.4695.python-list@python.org>
<87o72kygts.fsf@zedat.fu-berlin.de>
View all headers

Am Tue, Nov 12, 2024 at 09:52:31AM +0100 schrieb Loris Bennett via Python-list:

> Regarding your example above, if 'missingfile.py' contains the following
>
> import configparser
>
> config = configparser.ConfigParser()
>
> try:
> config.read('/foo/bar')
> except FileNotFoundError as e:
> print(f"Error: configuration file {config_file} not found: {e}")
>
> them
>
> python3 missingfile.py
>
> does not produce an any output for me and so does not seem to be a
> reliable way of handling the case where the config file does not exist.

Well:

>>> help(config.read)
Help on method read in module configparser:

read(filenames, encoding=None) method of configparser.ConfigParser instance
Read and parse a filename or an iterable of filenames.

Files that cannot be opened are silently ignored; this is
designed so that you can specify an iterable of potential
configuration file locations (e.g. current directory, user's
home directory, systemwide directory), and all existing
configuration files in the iterable will be read. A single
filename may also be given.

Return list of successfully read files.

So, the very fact that it does not return any output AND
returns an empty list is the (intended) way of knowing the
error state.

Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B

Subject: Re: FileNotFoundError thrown due to file name in file, rather than file itself
From: Rob Cliffe
Newsgroups: comp.lang.python
Date: Tue, 12 Nov 2024 21:04 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: rob.cliffe@btinternet.com (Rob Cliffe)
Newsgroups: comp.lang.python
Subject: Re: FileNotFoundError thrown due to file name in file, rather than
file itself
Date: Tue, 12 Nov 2024 21:04:02 +0000
Lines: 20
Message-ID: <mailman.103.1731445532.4695.python-list@python.org>
References: <26418.15836.335097.984240@ixdm.fritz.box>
<ZzJ0eoWZds3xSKWn@cskk.homeip.net>
<mailman.94.1731359879.4695.python-list@python.org>
<87o72kygts.fsf@zedat.fu-berlin.de>
<343ddd3d-65ec-4985-80a6-61e3c1e52353@btinternet.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de O44g+YTFrqTN+4zS6q/v0AzZk6vxB41I2SOBOxin8tgQ==
Cancel-Lock: sha1:XvWYO6rFb0wq7XUgPnHnlzQDq/Y= sha256:w2Hi3wS3sUFjUnY0eMdds8mfIdFZhr2bkBSskRARLZE=
Return-Path: <rob.cliffe@btinternet.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=btinternet.com header.i=@btinternet.com header.b=ajIpLlv5;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.105
X-Spam-Level: *
X-Spam-Evidence: '*H*': 0.81; '*S*': 0.02; 'subject:name': 0.07;
'writes:': 0.09; 'bennett': 0.16; 'cameron': 0.16; 'found:': 0.16;
'simpson': 0.16; 'wrote:': 0.16; 'code.': 0.19; 'to:addr:python-
list': 0.20; 'subject:file': 0.22; 'header:User-Agent:1': 0.30;
'python-list': 0.32; 'received:192.168.1': 0.32; 'header:In-Reply-
To:1': 0.34; 'received:192.168': 0.37; 'file': 0.38; 'put': 0.38;
'wishes': 0.40; 'should': 0.40; 'best': 0.61; 'generally': 0.67;
'piece': 0.69; 'rob': 0.84; 'so:': 0.84; 'subject: \n ': 0.84;
'subject:than': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=btinternet.com;
s=btmx2012311; t=1731445530;
bh=HJpbzmS2pT9eVlvB9YIZHdVqXJvF2favQpL6GJpA7t4=;
h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To;
b=ajIpLlv5jbeG7SYvocnZ/BjtmYpEiCv672LZjQK7tUv7GmFHPc5PclV3f+m7w0/OYLGPRYk80FVdW/HFkbGG+NN06D7E1NolhWEj5pUoro5oTzDogvKCw6To3EaHswSeWuRBzECHBqni2JvSUYAXyjy5X6/8UR+Q9QnVo2iG4GWg9x6OVRrjSrBLjKhax79OQQPdwUQ3UaIFq7M6QIWKcxwaLspoi8Rmk5V2AwTll1R7Yq/dWraS8PkPSIY8rUhpv3QXb/vapi96y1xrdmgpvY96rL9mLwUeCjKo1fyxBWxzXAX24DUsrWi8529zMOLYC7u9dcxZ68OotP7HtFRgWg==
X-SNCR-Rigid: 6722B0020174734F
X-Originating-IP: [86.169.232.54]
X-OWM-Source-IP: 86.169.232.54
X-OWM-Env-Sender: rob.cliffe@btinternet.com
X-VadeSecure-score: verdict=clean score=0/300, class=clean
X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgeefuddrudeggddugedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecunecujfgurheptgfkffggfgfuvfhfhfgjsegrtderredtvdejnecuhfhrohhmpeftohgsucevlhhifhhfvgcuoehrohgsrdgtlhhifhhfvgessghtihhnthgvrhhnvghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvgfeihfeuieeijeejieeuieetteekvdevhfejjedtudeugfdvleekfffhveehtdenucfkphepkeeirdduieelrddvfedvrdehgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopegludelvddrudeikedruddrvddtkegnpdhinhgvthepkeeirdduieelrddvfedvrdehgedpmhgrihhlfhhrohhmpehrohgsrdgtlhhifhhfvgessghtihhnthgvrhhnvghtrdgtohhmpdhrvghvkffrpehhohhsthekiedqudeiledqvdefvddqheegrdhrrghnghgvkeeiqdduieelrdgsthgtvghnthhrrghlphhluhhsrdgtohhmpdgruhhthhgpuhhsvghrpehrohgsrdgtlhhifhhfvgessghtihhnthgvrhhnvghtrdgtohhmpdhgvghokffrpefiuedpoffvtefjohhsthepsghtphhrughrghhotddthedpnhgspghrtghpthhtohepuddprhgtphhtthhopehphihthhhonhdqlhhishhtsehphihthhhonhdrohhrgh
X-RazorGate-Vade-Verdict: clean 0
X-RazorGate-Vade-Classification: clean
X-SNCR-hdrdom: btinternet.com
X-SNCR-hdrdom: btinternet.com
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <87o72kygts.fsf@zedat.fu-berlin.de>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <343ddd3d-65ec-4985-80a6-61e3c1e52353@btinternet.com>
X-Mailman-Original-References: <26418.15836.335097.984240@ixdm.fritz.box>
<ZzJ0eoWZds3xSKWn@cskk.homeip.net>
<mailman.94.1731359879.4695.python-list@python.org>
<87o72kygts.fsf@zedat.fu-berlin.de>
View all headers

On 12/11/2024 08:52, Loris Bennett via Python-list wrote:
> Cameron Simpson<cs@cskk.id.au> writes:
>
>> Generally you should put a try/except around the smallest possible
>> piece of code.
That is excellent advice.
Best wishes
Rob Cliffe
>> So:
>>
>> config = configparser.ConfigParser()
>> try:
>> config.read(args.config_file)
>> except FileNotFoundError as e:
>> print(f"Error: configuration file {args.config_file} not found: {e}")
>>
>>

1

rocksolid light 0.9.8
clearnet tor