File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 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):
8585 return total_size
8686
8787
88+ # noinspection PyUnresolvedReferences
8889class File (object ):
8990 @staticmethod
90- def read (path , log_content = False ):
91+ def read (path ):
9192 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 )
9793 if Settings .PYTHON_VERSION < 3 :
98- # noinspection PyUnresolvedReferences
94+ with open (path , 'r' ) as file_to_read :
95+ output = file_to_read .read ()
9996 return str (output .decode ('utf8' ).encode ('utf8' ))
10097 else :
98+ with open (path , 'r' , encoding = 'utf-8' , errors = 'ignore' ) as f :
99+ output = f .read ()
101100 return output
102101 else :
103102 raise IOError ("{0} not found!" .format (path ))
You can’t perform that action at this time.
0 commit comments