From 8a461f1eb7f7333b0c30faaa74226ff2d4de4d09 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 31 Jul 2019 17:54:40 +0200 Subject: More helpful error message when running qemu Signed-off-by: Laurent Bonnans (cherry-picked from commit 36f311912372be3150633b4da0f344c70e456d55) --- scripts/qemucommand.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 8b7da2b..daf2dd1 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -1,4 +1,4 @@ -from os.path import exists, join, realpath, abspath +from os.path import exists, isdir, join, realpath, abspath from os import listdir import random import socket @@ -42,6 +42,8 @@ class QemuCommand(object): if args.machine: self.machine = args.machine else: + if not isdir(args.dir): + raise ValueError("Directory %s does not exist, please specify a --machine or a valid images directory" % args.dir) machines = listdir(args.dir) if len(machines) == 1: self.machine = machines[0] -- cgit v1.2.3-54-g00ecf