From 5fe4353532348e21b3fe3459dd6c992374d2e783 Mon Sep 17 00:00:00 2001 From: Nick Papior Date: Tue, 11 Oct 2022 12:21:26 +0200 Subject: [PATCH] mnt: catch AttributeError explicitly --- sisl/io/sile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sisl/io/sile.py b/sisl/io/sile.py index 6407565c7a..6236fd2e8e 100644 --- a/sisl/io/sile.py +++ b/sisl/io/sile.py @@ -560,14 +560,14 @@ def __init__(self, filename, *args, **kwargs): try: filename = Path(filehandle.name) - except: + except AttributeError: # this is not optimal, it will be the current directory, but one should not be able # to write to it filename = Path() try: mode = filehandle.mode - except: + except AttributeError: # a StringIO will always be able to read *and* write # to its buffer mode = "rw"