mirror of
				https://github.com/avatao-content/baseimage-tutorial-framework
				synced 2025-11-04 11:02:55 +00:00 
			
		
		
		
	Fix non-unicode files kill whole webide backend
This commit is contained in:
		@@ -30,12 +30,12 @@ class FileManager:
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def file_contents(self):
 | 
			
		||||
        with open(self._filepath(self.filename), 'r') as ifile:
 | 
			
		||||
        with open(self._filepath(self.filename), 'r', errors='surrogateescape') as ifile:
 | 
			
		||||
            return ifile.read()
 | 
			
		||||
 | 
			
		||||
    @file_contents.setter
 | 
			
		||||
    def file_contents(self, value):
 | 
			
		||||
        with open(self._filepath(self.filename), 'w') as ofile:
 | 
			
		||||
        with open(self._filepath(self.filename), 'w', errors='surrogateescape') as ofile:
 | 
			
		||||
            ofile.write(value)
 | 
			
		||||
 | 
			
		||||
    def _filepath(self, filename):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user