File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -85,19 +85,18 @@ def get_size(folder):
85
85
return total_size
86
86
87
87
88
+ # noinspection PyUnresolvedReferences
88
89
class File (object ):
89
90
@staticmethod
90
- def read (path , log_content = False ):
91
+ def read (path ):
91
92
if File .exists (path ):
92
- 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
93
if Settings .PYTHON_VERSION < 3 :
98
- # noinspection PyUnresolvedReferences
94
+ with open (path , 'r' ) as file_to_read :
95
+ output = file_to_read .read ()
99
96
return str (output .decode ('utf8' ).encode ('utf8' ))
100
97
else :
98
+ with open (path , 'r' , encoding = 'utf-8' , errors = 'ignore' ) as f :
99
+ output = f .read ()
101
100
return output
102
101
else :
103
102
raise IOError ("{0} not found!" .format (path ))
You can’t perform that action at this time.
0 commit comments