mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
Use the FileExistsError exception.
This commit is contained in:
1 parent
a874b63e40
commit
872515fa78
6 files changed
+42
-42
No files matched your search
@@ -78,12 +78,13 @@ class Server(object):
|
||||
self._projects_dir = os.path.expandvars(os.path.expanduser(server_config.get("projects_directory", "~/Documents/GNS3/projects")))
|
||||
self._temp_dir = server_config.get("temporary_directory", tempfile.gettempdir())
|
||||
|
||||
if not os.path.isdir(self._projects_dir):
|
||||
try:
|
||||
os.makedirs(self._projects_dir)
|
||||
log.info("projects directory '{}' created".format(self._projects_dir))
|
||||
except OSError as e:
|
||||
log.error("could not create the projects directory {}: {}".format(self._projects_dir, e))
|
||||
try:
|
||||
os.makedirs(self._projects_dir)
|
||||
log.info("projects directory '{}' created".format(self._projects_dir))
|
||||
except FileExistsError:
|
||||
pass
|
||||
except OSError as e:
|
||||
log.error("could not create the projects directory {}: {}".format(self._projects_dir, e))
|
||||
|
||||
def load_modules(self):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user