mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add hint that python3 might be too old
This limitation of python-3.4 mkstemp() is the final reason we made python-3.5 our minimum version. Since we know about it, give a nice error to the user with a hint that Python3.4 could be the issue. Fixes #18160
This commit is contained in:
parent
5a0621db55
commit
fda933723c
1 changed files with 9 additions and 1 deletions
|
@ -1960,6 +1960,14 @@ class AnsibleModule(object):
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
e = get_exception()
|
e = get_exception()
|
||||||
self.fail_json(msg='The destination directory (%s) is not writable by the current user. Error was: %s' % (os.path.dirname(dest), e))
|
self.fail_json(msg='The destination directory (%s) is not writable by the current user. Error was: %s' % (os.path.dirname(dest), e))
|
||||||
|
except TypeError:
|
||||||
|
# We expect that this is happening because python3.4.x and
|
||||||
|
# below can't handle byte strings in mkstemp(). Traceback
|
||||||
|
# would end in something like:
|
||||||
|
# file = _os.path.join(dir, pre + name + suf)
|
||||||
|
# TypeError: can't concat bytes to str
|
||||||
|
self.fail_json(msg='Failed creating temp file for atomic move. This usually happens when using Python3 less than Python3.5. Please use Python2.x or Python3.5 or greater.', exception=sys.exc_info())
|
||||||
|
|
||||||
b_tmp_dest_name = to_bytes(tmp_dest_name, errors='surrogate_or_strict')
|
b_tmp_dest_name = to_bytes(tmp_dest_name, errors='surrogate_or_strict')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue