Private GIT

Skip to content
Snippets Groups Projects
Commit 1d5122a8 authored by Labrys of Knossos's avatar Labrys of Knossos
Browse files

Merge pull request #650 from labrys/io-open

Revert codecs.open to io.open
parents d46fda0f 12f1a5dd
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,7 @@ from __future__ import print_function
import codecs
import datetime
import getopt
import io
import locale
import os
import shutil
......@@ -419,7 +420,7 @@ class SickRage(object):
logger.log('Writing PID: %s to %s' % (pid, self.pid_file))
try:
with codecs.open(self.pid_file, 'w') as f_pid:
with io.open(self.pid_file, 'w') as f_pid:
f_pid.write('%s\n' % pid)
except EnvironmentError as error_message:
logger.log_error_and_exit('Unable to write PID file: %s Error: %s [%s]' % (self.pid_file, error_message.strerror, error_message.errno))
......
......@@ -24,7 +24,7 @@ Custom Logger for SickRage
from __future__ import unicode_literals
import codecs
import io
import os
import re
import sys
......@@ -250,13 +250,13 @@ class Logger(object): # pylint: disable=too-many-instance-attributes
log_data = None
if ek(os.path.isfile, self.log_file):
with codecs.open(self.log_file, encoding='utf-8') as log_f:
with io.open(self.log_file, encoding='utf-8') as log_f:
log_data = log_f.readlines()
for i in range(1, int(sickbeard.LOG_NR)):
f_name = '%s.%i' % (self.log_file, i)
if ek(os.path.isfile, f_name) and (len(log_data) <= 500):
with codecs.open(f_name, encoding='utf-8') as log_f:
with io.open(f_name, encoding='utf-8') as log_f:
log_data += log_f.readlines()
log_data = [line for line in reversed(log_data)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment