Deutsch English Français Italiano |
<mailman.98.1731428667.4695.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail From: dieter.maurer@online.de Newsgroups: comp.lang.python Subject: Re: FileNotFoundError thrown due to file name in file, rather than file itself Date: Tue, 12 Nov 2024 17:18:57 +0100 Lines: 27 Message-ID: <mailman.98.1731428667.4695.python-list@python.org> References: <26418.15836.335097.984240@ixdm.fritz.box> <ZzJ0eoWZds3xSKWn@cskk.homeip.net> <26419.32753.211549.746227@ixdm.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de o/UkJ/YVE1ASdZTHBxd4oANcarc3IdHDkykpmuwYP0Hw== Cancel-Lock: sha1:F0HqcHxM1oH/LN+NKf75ah2YR4I= sha256:WB3qND2nA52yY6rMKqU9orAR1zvruvVQdpqyIUMHIR0= Return-Path: <dieter.maurer@online.de> 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=online.de header.i=dieter.maurer@online.de header.b=hXCXidS2; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:212.227': 0.07; 'subject:name': 0.07; '(python': 0.09; 'cc:addr:python-list': 0.09; 'received:212.227.126': 0.09; 'cc:no real name:2**0': 0.14; 'bennett': 0.16; 'cameron': 0.16; 'found.': 0.16; 'program:': 0.16; 'simpson': 0.16; 'wrote:': 0.16; 'cc:addr:python.org': 0.20; 'exception': 0.22; 'subject:file': 0.22; 'cc:2**1': 0.23; 'code': 0.23; 'received:de': 0.23; 'skip:{ 20': 0.26; '>>>': 0.28; 'error': 0.29; 'received:kundenserver.de': 0.32; 'received:mout.kundenserver.de': 0.32; 'header:In-Reply-To:1': 0.34; 'fine': 0.35; 'following': 0.35; '...': 0.37; 'received:192.168': 0.37; 'file': 0.38; 'quite': 0.39; 'wrote': 0.39; 'file:': 0.40; 'learn': 0.40; 'likely': 0.61; 'your': 0.64; 'full': 0.64; 'well': 0.65; 'raised': 0.70; 'clause': 0.84; 'subject: \n ': 0.84; 'subject:than': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=online.de; s=s42582890; t=1731428665; x=1732033465; i=dieter.maurer@online.de; bh=azgND58uLvMxvq8p88tLnZn1wMrvpr0gOBy6p7xH2Pw=; h=X-UI-Sender-Class:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-ID:Date:From:To:Cc:Subject: In-Reply-To:References:cc:content-transfer-encoding:content-type: date:from:message-id:mime-version:reply-to:subject:to; b=hXCXidS2LANlLGQgXS+lLdMivdPlUv8+qCBx20zQGNuVNxVgOJX4+aeTXRjtyHww vHWGhGvqDH9eV0QPjrzG2SsSV190uUkXij8WXyjbmsUVZyIQCMki4KvcPOX3Hr8Uv kQyLkYB5jXikmKIbHJyCqG18NOB069d+NyL1weMnmv7cVNEVFFc5SXJlLwmYQFWPH 4r4etDYOIEOXHND5cCtex9hR+NBRdTeiFzrIg2yJM0pkHA7Y0q0y5ih9LODMK4MCu o9C33MIydqBsBt9mXq8JcnkWElbTmAoBZvHRG3pOM6G9QCS7cNFLnmUKpisE1No8Q rI6FC4DoE8EmBSd/fw== X-UI-Sender-Class: 6003b46c-3fee-4677-9b8b-2b628d989298 In-Reply-To: <ZzJ0eoWZds3xSKWn@cskk.homeip.net> X-Mailer: VM 8.0.12-devo-585 under 21.4 (patch 24) "Standard C" XEmacs Lucid (x86_64-linux-gnu) X-Provags-ID: V03:K1:+Z76CmuBELSO8WHyad7z0AU9hFlbhUmEDlbBTD9XpjXNan7Qxt9 xTdW8B5bUDJdGFItwjNt91woprHywieTds3pQMdecamlLks3atZXr0PxL7drEoZ231yUwBp z4e0opKkxnt+OJ2Kn9ptA8YmPSSwa1FhofZXnCGwnEjqEjphu27YJcvNzhtYvTkdBpC9gQK xImdIVfty0UDJGwgTEBJg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:6AHzGV01HH8=;0BdTky57bdEc+N6FVl39iRPCTzN eB9Hm+/Rnk6HjZ9zHxGUks0nDFxzznL0iNBpScQa15qW//MNqufTYpn2CsjB4aUD6HALMuBgq RLi9kHMxfPklejWxjZvVENfKS+6I5G0pGyD1B1bX858aXriDiVce/p5t3G8FqXGqiMpxvzDZ4 dtBQfl9bv515hUA82woj1DZGL9aY4EER1h2qsuu7r6meVbYoulclU9SzaL2DCAsAaAp0O1r01 DLC7nn8YzfhuqZYIC9ievGqPm/USJc3L8xL9D7QYQHLx/2mFdAvSN3/hXMhxCkuLo5y920G/f 4y85yfINx7449iEMfr/1dDhbVxbVUj+xBZECh9ajVW5kfmbpk0kTYk5PO6NaeOGm3VZamYMRM 6NS8gb6MEPFF22ztPLHmoPKrieO2ky4/9jKgI/kE/DsURsy9ex8tpBqR+viZXnWsrzjy1bUKa DYfneonR/FuwVBP3DDxxBOGkxalw1BfSmTCQvzGThhuDq62YJc74rKba9mi6X4N69WbhIQxfN ms7uzcLikkC7nY9UfoVMhVnTk/6t9mTEnQAhxHX/fwSNmvrTfOpr/nxSviWI0iBftf7006uJS uBKdfWRp1456kM+SlaO2mRzwNPMxrUnVru332yEhQmyfJ9FxzcWrzjFM1uzmO8X/vpX6NQJ5r IraLbwCCbD9sdvqT0aEfFxA37b9mp1CbMe0A9qkIimyURfn8IdNtY4uRmZH8xX3cxYkPjbAyN KPlvwEu/DGfnrvu2WdEmvY3mVPTEBXkRQ== 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: <26419.32753.211549.746227@ixdm.fritz.box> X-Mailman-Original-References: <26418.15836.335097.984240@ixdm.fritz.box> <ZzJ0eoWZds3xSKWn@cskk.homeip.net> Bytes: 6103 Cameron Simpson wrote at 2024-11-12 08:17 +1100: >On 11Nov2024 18:24, dieter.maurer@online.de <dieter.maurer@online.de> wro= te: >>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 =3D 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. The original exception likely tells us which file was not found.