Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use codecs module while reading & writing json cache file #10630

Merged
merged 1 commit into from
Apr 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/ansible/cache/jsonfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import time
import errno
import codecs

try:
import simplejson as json
Expand Down Expand Up @@ -57,7 +58,7 @@ def get(self, key):

cachefile = "%s/%s" % (self._cache_dir, key)
try:
f = open( cachefile, 'r')
f = codecs.open(cachefile, 'r', encoding='utf-8')
except (OSError,IOError), e:
utils.warning("error while trying to write to %s : %s" % (cachefile, str(e)))
else:
Expand All @@ -73,7 +74,7 @@ def set(self, key, value):

cachefile = "%s/%s" % (self._cache_dir, key)
try:
f = open(cachefile, 'w')
f = codecs.open(cachefile, 'w', encoding='utf-8')
except (OSError,IOError), e:
utils.warning("error while trying to read %s : %s" % (cachefile, str(e)))
else:
Expand Down