From 6be7ac8eee54fac0af75f8f56dece32aa059d8d0 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Mon, 24 Feb 2020 14:53:15 +0100 Subject: [PATCH] fix two cases of opening a file binary might fix https://github.com/galaxyproject/galaxy/issues/9328 --- .../galaxy_install/tool_dependencies/recipe/step_handler.py | 4 ++-- .../galaxy_install/tool_dependencies/recipe/tag_handler.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py index 6b7176dee3a..f44b144f860 100644 --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py @@ -549,9 +549,9 @@ class DownloadByUrl(Download, RecipeStep): if is_binary: log_file = os.path.join(install_environment.install_dir, basic_util.INSTALLATION_LOG) if os.path.exists(log_file): - logfile = open(log_file, 'ab') + logfile = open(log_file, 'a') else: - logfile = open(log_file, 'wb') + logfile = open(log_file, 'w') logfile.write('Successfully downloaded from url: %s\n' % action_dict['url']) logfile.close() log.debug('Successfully downloaded from url: %s' % action_dict['url']) diff --git a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py index a7e6b0f1d76..b63e051a78b 100644 --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py @@ -253,10 +253,10 @@ class Repository(RecipeTag, SyncDatabase): text = url_get(tool_shed_url, password_mgr=self.app.tool_shed_registry.url_auth(tool_shed_url), pathspec=pathspec, params=params) if text: # Write the contents to a temporary file on disk so it can be reloaded and parsed. - fh = tempfile.NamedTemporaryFile('wb', prefix="tmp-toolshed-cttdc") + fh = tempfile.NamedTemporaryFile('w', prefix="tmp-toolshed-cttdc") tmp_filename = fh.name fh.close() - fh = open(tmp_filename, 'wb') + fh = open(tmp_filename, 'w') fh.write(text) fh.close() return tmp_filename