1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Use to_bytes instead of .encode(). Fixes the fact that errors is a positional argument, not a kw arg in .encode()

This commit is contained in:
Toshio Kuratomi 2015-03-04 11:05:46 -08:00
parent 618722ddee
commit fbc525cfb6

View file

@ -28,7 +28,7 @@ import constants
import locale
from ansible.color import stringc
from ansible.module_utils import basic
from ansible.utils.unicode import to_unicode
from ansible.utils.unicode import to_unicode, to_bytes
import logging
if constants.DEFAULT_LOG_PATH != '':
@ -634,9 +634,9 @@ class PlaybookCallbacks(object):
name = utils.unicode.to_unicode(name)
msg = u'Perform task: %s (y/n/c): ' % name
if sys.stdout.encoding:
msg = msg.encode(sys.stdout.encoding, errors='replace')
msg = to_bytes(msg, sys.stdout.encoding)
else:
msg = msg.encode('utf-8')
msg = to_bytes(msg)
resp = raw_input(msg)
if resp.lower() in ['y','yes']:
self.skip_task = False