# HG changeset patch
# User Hartmut Goebel <h.goebel@crazy-compilers.com>
# Date 1477565507 -7200
# Node ID 700f4d003349dfd83922354b9b23802e1ef004fa
# Parent  98a53c3282c3152a1c3b3f6446fc893e8ec22a6f
Catch missing xml2yml.ysl2 early.

diff -r 98a53c3282c3 -r 700f4d003349 yml2proc
--- a/yml2proc	Tue Mar 17 10:12:14 2020 +0100
+++ b/yml2proc	Thu Oct 27 12:51:47 2016 +0200
@@ -94,16 +94,15 @@
 
 if options.xml2yml:
     for directory in backend.includePath:
-        try:
-            name = directory + "/xml2yml.ysl2"
-            f = open(name, "r")
-            f.close()
+        name = os.path.join(directory, "xml2yml.ysl2")
+        if os.path.isfile(name):
+            options.yslt = name
+            options.xml = True
             break
-        except:
-            pass
-
-    options.yslt = name
-    options.xml = True
+    else:
+        sys.stderr.write("Error: Stylesheet xml2yml.ysl2 required for --xml2yml not found\n")
+        sys.stderr.write("Please check your YML_PATH\n")
+        sys.exit(1)
 
 if  (options.xslt and options.yslt) or (options.xslt and options.xpath) or (options.yslt and options.xpath):
     sys.stderr.write("Cannot combine --xpath, --xslt and --yslt params\n")