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

Liste des GroupesRevenir à cl python 
Sujet : Re: FileNotFoundError thrown due to file name in file, rather than file itself
De : rob.cliffe (at) *nospam* btinternet.com (Rob Cliffe)
Groupes : comp.lang.python
Date : 12. Nov 2024, 22:04:02
Autres entêtes
Message-ID : <mailman.103.1731445532.4695.python-list@python.org>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
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}")
>
>

Date Sujet#  Auteur
11 Nov 24 * Re: FileNotFoundError thrown due to file name in file, rather than file itself4Cameron Simpson
12 Nov 24 `* Re: FileNotFoundError thrown due to file name in file, rather than file itself3Loris Bennett
12 Nov 24  +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Karsten Hilbert
12 Nov 24  `- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Rob Cliffe

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal