We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75c879b commit ecf71efCopy full SHA for ecf71ef
core/utils/file_utils.py
@@ -85,19 +85,18 @@ def get_size(folder):
85
return total_size
86
87
88
+# noinspection PyUnresolvedReferences
89
class File(object):
90
@staticmethod
- def read(path, log_content=False):
91
+ def read(path):
92
if File.exists(path):
- with open(path, 'r') as file_to_read:
93
- output = file_to_read.read()
94
- if log_content:
95
- Log.info('Read ' + path + ':')
96
- Log.info(output)
97
if Settings.PYTHON_VERSION < 3:
98
- # noinspection PyUnresolvedReferences
+ with open(path, 'r') as file_to_read:
+ output = file_to_read.read()
99
return str(output.decode('utf8').encode('utf8'))
100
else:
+ with open(path, 'r', encoding='utf-8', errors='ignore') as f:
+ output = f.read()
101
return output
102
103
raise IOError("{0} not found!".format(path))
0 commit comments