From 2da20177a28e335de6fe5cdbd45ee4fa0c741dfa Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 27 Jan 2017 10:56:48 +0100 Subject: [PATCH] Avoid crash when you broke your system permissions Fix #877 --- gns3server/utils/images.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gns3server/utils/images.py b/gns3server/utils/images.py index 03bb3d16..fd867aa6 100644 --- a/gns3server/utils/images.py +++ b/gns3server/utils/images.py @@ -130,8 +130,11 @@ def images_directories(type): paths = [] img_dir = os.path.expanduser(server_config.get("images_path", "~/GNS3/images")) type_img_directory = default_images_directory(type) - os.makedirs(type_img_directory, exist_ok=True) - paths.append(type_img_directory) + try: + os.makedirs(type_img_directory, exist_ok=True) + paths.append(type_img_directory) + except (OSError, PermissionError): + pass for directory in server_config.get("additional_images_path", "").split(";"): paths.append(directory) # Compatibility with old topologies we look in parent directory