From eb0c6dfae7a38a310ad2a633306af58b495290fd Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 3 Oct 2023 11:45:11 +0100 Subject: [PATCH] Clarify the error message when a file cannot be opened for reading --- S3/S3.py | 2 +- s3cmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/S3/S3.py b/S3/S3.py index 9bf2e924..14c0ddeb 100644 --- a/S3/S3.py +++ b/S3/S3.py @@ -700,7 +700,7 @@ def object_put(self, filename, uri, extra_headers = None, extra_label = ""): size = stat[ST_SIZE] src_stream.stream_name = filename except (IOError, OSError) as e: - raise InvalidFileError(u"%s" % e.strerror) + raise InvalidFileError(u"failed to open the file for reading (%s)" % e.strerror) headers = SortedDict(ignore_case=True) if extra_headers: diff --git a/s3cmd b/s3cmd index 9d56b1f7..b23c0e48 100755 --- a/s3cmd +++ b/s3cmd @@ -470,7 +470,7 @@ def cmd_object_put(args): ret = EX_PARTIAL continue except InvalidFileError as exc: - error(u"Upload of '%s' is not possible (Reason: %s)" % (full_name_orig, exc)) + error(u"Upload of '%s' is not possible. Reason: %s." % (full_name_orig, exc)) ret = EX_PARTIAL if cfg.stop_on_error: ret = EX_OSFILE