Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail From: "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 10:03:10 +0100 Organization: FUB-IT, Freie =?utf-8?Q?Universit=C3=A4t?= Berlin Lines: 18 Message-ID: <87a5e4ygc1.fsf@zedat.fu-berlin.de> References: <87v7wt986z.fsf@zedat.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain X-Trace: news.uni-berlin.de gOehtvHKXYuZXTyzca9enwvWfAukXwUVDgr8Ui3fHPiGoD Cancel-Lock: sha1:k/vcnI5AMQA+rgwn6gBBnahP+TU= sha1:Dcu0p2ooIs7PrAxu+z+WWGSMldQ= sha256:4f0IzUZEt6DcTO13uGsm5way6qps+KBZInUN/UAh/MI= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Bytes: 1643 Chris Angelico writes: > On Tue, 12 Nov 2024 at 01:59, Loris Bennett via Python-list > wrote: >> 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? > > By looking at the exception's attributes rather than assuming and > hard-coding the path in your message? Or, even better, just let the > exception bubble. I didn't consider letting the exception bubble as is the top of the code for a CLI program. I was hoping to just catch what I thought might be a common error of the config file being missing. -- This signature is currently under constuction.