Deutsch English Français Italiano |
<mailman.106.1731538158.4695.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Kushal Kumaran <kushal@locationd.net> Newsgroups: comp.lang.python Subject: Re: FileNotFoundError thrown due to file name in file, rather than file itself Date: Wed, 13 Nov 2024 14:40:57 -0800 Lines: 21 Message-ID: <mailman.106.1731538158.4695.python-list@python.org> References: <87v7wt986z.fsf@zedat.fu-berlin.de> <CAPTjJmoJErFTE-oS2X_Z+2yC6bMXvHZi0=CxkGhWnVtd4Gacvw@mail.gmail.com> <mailman.96.1731374262.4695.python-list@python.org> <87h68cyggb.fsf@zedat.fu-berlin.de> <26420.61844.597011.839900@ixdm.fritz.box> <87msi2eozq.fsf@copper> Mime-Version: 1.0 Content-Type: text/plain X-Trace: news.uni-berlin.de yu3mCIpcsUHoRdWFBnlEsgxwTANrNW8hRYJD5SiyFJjg== Cancel-Lock: sha1:2o/Qy7yHeHPdYNAKuUtOWzX+VI0= sha256:M80SjFuHulEHAkFt3wZCyJ+P0O7+M/sMO7P91vOddks= Return-Path: <kushal@locationd.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=locationd.net header.i=@locationd.net header.b=HhPtFabg; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.138 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.73; '*S*': 0.01; 'subject:name': 0.07; 'skip:` 10': 0.09; 'log': 0.12; 'bennett': 0.16; 'exception.': 0.16; 'kushal': 0.16; 'wrote:': 0.16; 'pm,': 0.19; 'to:addr :python-list': 0.20; 'exception': 0.22; 'subject:file': 0.22; 'header:User-Agent:1': 0.30; 'default': 0.31; 'path': 0.33; 'header:In-Reply-To:1': 0.34; 'really': 0.36; '...': 0.37; 'missing': 0.37; 'directory': 0.37; 'file': 0.38; 'wed,': 0.39; 'wrote': 0.39; 'situation': 0.40; 'want': 0.40; 'should': 0.40; 'tell': 0.60; 'mode': 0.62; 'point.': 0.62; 'imagine': 0.64; 'look': 0.65; 'obvious': 0.69; 'happens': 0.84; 'subject: \n ': 0.84; 'thus,': 0.84; 'subject:than': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=locationd.net; s=s1; t=1731537660; bh=GCVHkkneppy8N+epHzOnIUoKSwNqEbwywwxNW2yPaYQ=; h=From:To:Subject:References:Date:In-Reply-To:From; b=HhPtFabgs5mm0UdnfVVuEWHAW8LdEvP9f8wdqPJhsg8t/4CaxSfbOqNzfCxmgq6P2 g1UZMTLsQmK+9IJ6FIVTuPQLjJYsrU+0k0wME/PO5SZap+F3Kh8Et1pmC7lwwvzAor uncsy5UoHGG+xRbEvQJ/VTphORcknWADeV+R+/DIKsd6V7ogck4umq/2DqqmClaids Q0PWAp905h151zr218KIaNzDGaHLF1sTsG1J5E24i7Nm4p4qe3BBlaSjVl5L0AROOS IqFo1/UNOJVbcGJpNujqD8vOQAmSzQ5GCoU+d6sty4rXEvwJCuiNjJaEtc0Y3Eb3yd 67HS0ZV+aFs2g== X-Clacks-Overhead: GNU Terry Pratchett In-Reply-To: <26420.61844.597011.839900@ixdm.fritz.box> (dieter maurer's message of "Wed, 13 Nov 2024 19:36:04 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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: <87msi2eozq.fsf@copper> X-Mailman-Original-References: <87v7wt986z.fsf@zedat.fu-berlin.de> <CAPTjJmoJErFTE-oS2X_Z+2yC6bMXvHZi0=CxkGhWnVtd4Gacvw@mail.gmail.com> <mailman.96.1731374262.4695.python-list@python.org> <87h68cyggb.fsf@zedat.fu-berlin.de> <26420.61844.597011.839900@ixdm.fritz.box> Bytes: 4474 On Wed, Nov 13 2024 at 07:36:04 PM, dieter.maurer@online.de wrote: > Loris Bennett wrote at 2024-11-12 10:00 +0100: >> ... >>However, it strikes me as not immediately obvious that the logging file >>must exist at this point. I can imagine a situation in which I want to >>configure a default log file and create it if it missing. > > This is what happens usually: > if you open a file with mode `a` or `w`, the file is created > if it does not yet exist. > > Thus, a missing log file should not give you the `FileNotFound` > exception. > Look at the exception details: they should tell you what really > was not found (maybe the directory for the logfile). It is possible a directory along the path does not exist. -- regards, kushal