[elbe-devel] [PATCH] preprocess: give a sane error msg if input is no file

Manuel Traut manut at linutronix.de
Wed Aug 2 15:34:01 CEST 2017


Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/commands/preprocess.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/elbepack/commands/preprocess.py b/elbepack/commands/preprocess.py
index 06f538eb..7eef1be4 100644
--- a/elbepack/commands/preprocess.py
+++ b/elbepack/commands/preprocess.py
@@ -19,6 +19,7 @@
 from __future__ import print_function
 
 import sys
+import os
 from optparse import OptionParser
 from elbepack.xmlpreprocess import XMLPreprocessError, xmlpreprocess
 
@@ -34,6 +35,10 @@ def run_command( argv ):
         oparser.print_help()
         sys.exit(20)
 
+    if not os.path.isfile(args[0]):
+        print("%s doesn't exist" % args[0], file=sys.stderr)
+        sys.exit(20)
+
     try:
         xmlpreprocess(args[0], opt.output)
     except XMLPreprocessError as e:
-- 
2.13.3





More information about the elbe-devel mailing list