Skip to content

Instantly share code, notes, and snippets.

@kosyfrances
Created May 8, 2016 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosyfrances/2e095eba6153c7f3a6b3eccbce1e0dfb to your computer and use it in GitHub Desktop.
Save kosyfrances/2e095eba6153c7f3a6b3eccbce1e0dfb to your computer and use it in GitHub Desktop.
Running ansible playbook gives unknown encoding error

While running ansible playbook, I encountered this error

Traceback (most recent call last):
  File "/usr/local/bin/ansible-playbook", line 110, in <module>
    display.error("Unexpected Exception: %s" % to_unicode(e), wrap_text=False)
  File "/Library/Python/2.7/site-packages/ansible/utils/display.py", line 261, in error
    self.display(new_msg, color=C.COLOR_ERROR, stderr=True)
  File "/Library/Python/2.7/site-packages/ansible/utils/display.py", line 124, in display
    msg2 = to_bytes(msg2, encoding=self._output_encoding(stderr=stderr))
  File "/Library/Python/2.7/site-packages/ansible/utils/unicode.py", line 208, in to_bytes
    return obj.encode(encoding, errors)
LookupError: unknown encoding:
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

I added these environmental variables and the problem was solved.

$ export LANG=en_US.UTF-8  
$ export LC_ALL=en_US.UTF-8  

More information can be found in the issue here ansible/ansible#14053

@mick-t
Copy link

mick-t commented Jun 12, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment