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

Merge pull request #6313 from phenomenes/msg-encoding-fix

Don't use keyword `error` in encode
This commit is contained in:
Michael DeHaan 2014-03-06 10:59:11 -06:00
commit acd64bf5a1

View file

@ -597,7 +597,8 @@ def main():
except psycopg2.Error, e: except psycopg2.Error, e:
conn.rollback() conn.rollback()
# psycopg2 errors come in connection encoding, reencode # psycopg2 errors come in connection encoding, reencode
msg = e.message.decode(conn.encoding).encode(errors='replace') msg = e.message.decode(conn.encoding).encode(sys.getdefaultencoding(),
'replace')
module.fail_json(msg=msg) module.fail_json(msg=msg)
if module.check_mode: if module.check_mode: