diff --git a/lib/galaxy/tool_util/linters/general.py b/lib/galaxy/tool_util/linters/general.py index 0c45c06ab84..c2624daca81 100644 --- a/lib/galaxy/tool_util/linters/general.py +++ b/lib/galaxy/tool_util/linters/general.py @@ -23,7 +23,7 @@ lint_tool_types = ["*"] def lint_general(tool_source, lint_ctx): """Check tool version, name, and id.""" - version = tool_source.parse_version() + version = tool_source.parse_version() or '' parsed_version = packaging.version.parse(version) if not version: lint_ctx.error(ERROR_VERSION_MSG) diff --git a/lib/galaxy/tool_util/loader_directory.py b/lib/galaxy/tool_util/loader_directory.py index c21937987b7..310ea7cba09 100644 --- a/lib/galaxy/tool_util/loader_directory.py +++ b/lib/galaxy/tool_util/loader_directory.py @@ -1,6 +1,7 @@ """Utilities for loading and reasoning about unparsed tools in directories.""" import fnmatch import glob +import io import logging import os import re @@ -170,8 +171,11 @@ def looks_like_xml(path, regex=TOOL_REGEX): checkers.is_zip(full_path)): return False - with open(path, "r") as f: - start_contents = f.read(5 * 1024) + with io.open(path, "r", encoding='utf-8') as f: + try: + start_contents = f.read(5 * 1024) + except UnicodeDecodeError: + return False if regex.search(start_contents): return True