Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197010

Re: FileNotFoundError thrown due to file name in file, rather than file itself

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 2024-11-12 21:04 +0000
Message-ID <mailman.103.1731445532.4695.python-list@python.org> (permalink)
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>

Show all headers | View raw




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}")
>>
>>

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

Re: FileNotFoundError thrown due to file name in file, rather than file itself Cameron Simpson <cs@cskk.id.au> - 2024-11-12 08:17 +1100
  Re: FileNotFoundError thrown due to file name in file, rather than file itself "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-11-12 09:52 +0100
    Re: FileNotFoundError thrown due to file name in file, rather than file itself Karsten Hilbert <Karsten.Hilbert@gmx.net> - 2024-11-12 18:47 +0100
    Re: FileNotFoundError thrown due to file name in file, rather than file itself Rob Cliffe <rob.cliffe@btinternet.com> - 2024-11-12 21:04 +0000

csiph-web