diff --git a/sisl/io/sile.py b/sisl/io/sile.py index 6407565c7..6236fd2e8 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"