From 00efa6e794d79683b5c2940fb9d879712df76284 Mon Sep 17 00:00:00 2001 From: Markus Neteler Date: Mon, 13 Feb 2023 20:46:19 +0100 Subject: [PATCH] startup: catch errors in build_modules_xml.py, grass.py (#2686) * build_modules_xml.py, grass.py: catch errors This PR is an extract from #348: - gui/wxpython/tools/build_modules_xml.py edits: https://github.com/OSGeo/grass/pull/348/files#diff-11ca77721b6d009b6537c54be4172efed843021797676258ad1141a6c63e6fd1 - lib/init/grass.py: https://github.com/OSGeo/grass/pull/348/files#diff-647be4ef599868c33f2f69f0d899f79f0aee8d75d1db74f523268c1ac94cddf7 --- gui/wxpython/tools/build_modules_xml.py | 5 +++-- lib/init/grass.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gui/wxpython/tools/build_modules_xml.py b/gui/wxpython/tools/build_modules_xml.py index d434aadfced..11d8ca691c9 100644 --- a/gui/wxpython/tools/build_modules_xml.py +++ b/gui/wxpython/tools/build_modules_xml.py @@ -18,6 +18,7 @@ import grass.script.core as gcore import grass.script.task as gtask +from grass.exceptions import ScriptError def escapeXML(text): @@ -80,11 +81,11 @@ def get_module_metadata(name): """ try: task = gtask.parse_interface(name) - except: + except ScriptError as exc: sys.stderr.write( "Cannot parse interface for module %s. Empty strings" " will be placed instead of description and keywords." - "\n" % name + " Reason: %s\n" % (name, str(exc)) ) return "", "" diff --git a/lib/init/grass.py b/lib/init/grass.py index 3142895485e..3d96eac55de 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -769,7 +769,8 @@ def set_paths(grass_config_dir): # Set LD_LIBRARY_PATH (etc) to find GRASS shared libraries # this works for subprocesses but won't affect the current process - path_prepend(gpath("lib"), LD_LIBRARY_PATH_VAR) + if LD_LIBRARY_PATH_VAR: + path_prepend(gpath("lib"), LD_LIBRARY_PATH_VAR) def find_exe(pgm):