Skip to content

Commit

Permalink
Change read/write of cache file to binary mode (#36)
Browse files Browse the repository at this point in the history
Fixes #31
Fixes #35
  • Loading branch information
iliakonnov authored and waldyrious committed Mar 2, 2017
1 parent 2e6d55f commit 846e21f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tldr.py
Expand Up @@ -80,7 +80,7 @@ def get_cache_file_path(command, platform):

def load_page_from_cache(command, platform):
try:
with open(get_cache_file_path(command, platform)) as cache_file:
with open(get_cache_file_path(command, platform), 'rb') as cache_file:
cache_file_contents = cache_file.read()
return cache_file_contents
except Exception:
Expand All @@ -104,7 +104,7 @@ def mkdir_p(path):
try:
cache_file_path = get_cache_file_path(command, platform)
mkdir_p(os.path.dirname(cache_file_path))
with open(cache_file_path, "w") as cache_file:
with open(cache_file_path, "wb") as cache_file:
cache_file.write(page)
except Exception:
pass
Expand Down

0 comments on commit 846e21f

Please sign in to comment.