How to 'ignore' an error in Python?

jak nospam at please.ty
Sat Apr 29 10:43:38 EDT 2023


Stefan Ram ha scritto:
> jak <nospam at please.ty> writes:
>> Maybe I only say this because it has happened to me too many times but
>> before ignoring the error in the 'except' branch, I would make sure that
>> if the name exists it is a folder and not a file.
> 
>    If the name exists and it is a file's name, this will be detected
>    by "mkdir( exist_ok=True )", and an object will be raised. Such
>    an object, indeed, usually should /not/ be ignored by the caller.
>    But there is no reason to deviate from the EAFP path.
> 
> 


Maybe I expressed myself badly but I didn't mean to propose alternatives
to the EAFP way but just to evaluate the possibility that it is not a
folder.


More information about the Python-list mailing list