--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/yamlCheckSyntax.py Sat Jul 08 12:08:27 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/yamlCheckSyntax.py Sat Jul 08 16:20:59 2023 +0200 @@ -157,27 +157,28 @@ errors), the message, a list with arguments for the message) @rtype dict """ - try: - from yaml import MarkedYAMLError, safe_load_all # __IGNORE_WARNING_I10__ - except ImportError: - error = "pyyaml not available. Install it via the PyPI interface." - return [{"error": (file, 0, 0, "", error)}] + if codestring: + try: + from yaml import MarkedYAMLError, safe_load_all # __IGNORE_WARNING_I10__ + except ImportError: + error = "pyyaml not available. Install it via the PyPI interface." + return [{"error": (file, 0, 0, "", error)}] - try: - for _obj in safe_load_all(codestring): - # do nothing with it, just to get parse errors - pass - except MarkedYAMLError as exc: - if exc.problem_mark: - line = exc.problem_mark.line + 1 - column = exc.problem_mark.column - else: - line, column = 0, 0 - error = exc.problem + try: + for _obj in safe_load_all(codestring): + # do nothing with it, just to get parse errors + pass + except MarkedYAMLError as exc: + if exc.problem_mark: + line = exc.problem_mark.line + 1 + column = exc.problem_mark.column + else: + line, column = 0, 0 + error = exc.problem - cline = min(len(codestring.splitlines()), int(line)) - 1 - code = codestring.splitlines()[cline] + cline = min(len(codestring.splitlines()), int(line)) - 1 + code = codestring.splitlines()[cline] - return [{"error": (file, line, column, code, error)}] + return [{"error": (file, line, column, code, error)}] return [{}]