From 30f6263146ea078655cc73a3aecde986ad181ff0 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 22 Apr 2015 21:42:36 -0600 Subject: [PATCH] Don't assume the PATH environment variable exists. --- gns3server/modules/qemu/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gns3server/modules/qemu/__init__.py b/gns3server/modules/qemu/__init__.py index 510f6aab..66a1a968 100644 --- a/gns3server/modules/qemu/__init__.py +++ b/gns3server/modules/qemu/__init__.py @@ -30,6 +30,9 @@ from ..base_manager import BaseManager from .qemu_error import QemuError from .qemu_vm import QemuVM +import logging +log = logging.getLogger(__name__) + class Qemu(BaseManager): @@ -44,7 +47,11 @@ class Qemu(BaseManager): """ qemus = [] - paths = [os.getcwd()] + os.environ["PATH"].split(os.pathsep) + paths = [os.getcwd()] + if "PATH" in os.environ: + paths.extend(os.environ["PATH"].split(os.pathsep)) + else: + log.warning("The PATH environment variable doesn't exist") # look for Qemu binaries in the current working directory and $PATH if sys.platform.startswith("win"): # add specific Windows paths