Deutsch English Français Italiano |
<mailman.103.1731445532.4695.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Rob Cliffe <rob.cliffe@btinternet.com> 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> Bytes: 5309 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}") >> >>