1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 14:48:49 +00:00

py3 don't encode

This commit is contained in:
lovedboy 2015-11-18 00:39:29 +08:00
parent 100226ee9c
commit 06386601d9

View File

@ -12,7 +12,7 @@ import os
import shlex
import six
from .utils import DEVNULL, memoize, cache
import sys
class Generic(object):
@ -49,7 +49,10 @@ class Generic(object):
history_file_name = self._get_history_file_name()
if os.path.isfile(history_file_name):
with open(history_file_name, 'a') as history:
history.write(self._get_history_line(command_script).encode("utf-8"))
if sys.version_info >= (3, 0):
history.write(self._get_history_line(command_script))
else:
history.write(self._get_history_line(command_script).encode("utf-8"))
def _script_from_history(self, line):
"""Returns prepared history line.