mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use codecs module while reading & writing json cache file
This commit is contained in:
parent
7076298dc1
commit
9409cc7443
1 changed files with 3 additions and 2 deletions
5
lib/ansible/cache/jsonfile.py
vendored
5
lib/ansible/cache/jsonfile.py
vendored
|
@ -18,6 +18,7 @@
|
|||
import os
|
||||
import time
|
||||
import errno
|
||||
import codecs
|
||||
|
||||
try:
|
||||
import simplejson as json
|
||||
|
@ -57,7 +58,7 @@ class CacheModule(BaseCacheModule):
|
|||
|
||||
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:
|
||||
|
@ -73,7 +74,7 @@ class CacheModule(BaseCacheModule):
|
|||
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue