From de7b6ec22f0f0962ec1b8bfd2172f72ba9e58d07 Mon Sep 17 00:00:00 2001 From: flan Date: Wed, 8 Nov 2017 13:49:28 +0100 Subject: [PATCH] Remove redundant try/catch block around os.makedirs() --- ankisyncd/collection.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ankisyncd/collection.py b/ankisyncd/collection.py index b7e9563..8ea3957 100644 --- a/ankisyncd/collection.py +++ b/ankisyncd/collection.py @@ -47,12 +47,7 @@ class CollectionWrapper: """Creates a new collection and runs any special setup.""" # mkdir -p the path, because it might not exist - dirname = os.path.dirname(self.path) - try: - os.makedirs(dirname) - except OSError as exc: - if exc.errno != errno.EEXIST: - raise + os.makedirs(os.path.dirname(self.path), exist_ok=True) col = anki.storage.Collection(self.path, server=True)