Don't assume the PATH environment variable exists.

This commit is contained in:
grossmj 2015-04-22 21:42:36 -06:00
parent 161adb781b
commit 30f6263146

View File

@ -30,6 +30,9 @@ from ..base_manager import BaseManager
from .qemu_error import QemuError from .qemu_error import QemuError
from .qemu_vm import QemuVM from .qemu_vm import QemuVM
import logging
log = logging.getLogger(__name__)
class Qemu(BaseManager): class Qemu(BaseManager):
@ -44,7 +47,11 @@ class Qemu(BaseManager):
""" """
qemus = [] 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 # look for Qemu binaries in the current working directory and $PATH
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
# add specific Windows paths # add specific Windows paths