Changeset 13618
- Timestamp:
- Sep 30, 2019 2:31:26 PM (2 months ago)
- Location:
- branches/dev-5819/Python/src/pymodelica
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dev-5819/Python/src/pymodelica/compiler_logging.py
r13600 r13618 114 114 # apparently self.last is of class 'bytes' in py3 115 115 # compared to class 'str' in py2 116 self.last = self.last.decode('utf-8') 117 self.line += self.last.count('\n') 116 self.line += str(self.last.decode('utf-8')).count('\n') 118 117 # Get the two last lines 119 lines = s elf.last.rsplit('\n', 2)118 lines = str(self.last.decode('utf-8')).rsplit('\n', 2) 120 119 # Update lastLine and secondLastLine depending on how many 121 120 # rows we got … … 145 144 dump_file.write(self.last) 146 145 147 lines = s elf.last.split('\n')146 lines = str(self.last.decode('utf-8')).split('\n') 148 147 lines[0] = self.lastLine + lines[0] 149 148 … … 157 156 dump_file.write(more) 158 157 while localLine + 2 >= len(lines) and more: 159 pos = more.find('\n')158 pos = str(more.decode('utf-8')).find('\n') 160 159 if pos == -1: 161 160 lines[-1] = lines[-1] + more … … 191 190 192 191 # Discard remaining data. 193 data = self.stream.read() 194 dump_file.write(data) 195 while data is None or data != '': 192 # Check if not already closed since later versions of xmlreader closes it by itself 193 if not self.stream.closed: 196 194 data = self.stream.read() 197 195 dump_file.write(data) 198 dump_file.close() 196 while data is None or data != '': 197 data = self.stream.read() 198 dump_file.write(data) 199 dump_file.close() 199 200 200 201 message += "%sDump of the log has been saved in %s" % (os.linesep, dump_file.name) -
branches/dev-5819/Python/src/pymodelica/compiler_wrappers.py
r13593 r13618 390 390 CompilerError if one or more error is found during compilation. 391 391 392 IOError if the model file is not found, can not be read or any other393 IOrelated error.392 OSError if the model file is not found, can not be read or any other 393 OS related error. 394 394 395 395 Exception if there are general errors related to the parsing of the … … 471 471 ModelicaClassNotFoundError if the model class is not found. 472 472 473 IOError if the model file is not found, can not be read or any474 other IOrelated error.473 OSError if the model file is not found, can not be read or any 474 other OS related error. 475 475 476 476 JError if there was a runtime exception thrown by the underlying … … 502 502 Raises:: 503 503 504 IOError if the model file is not found, can not be read or any other505 IOrelated error.504 OSError if the model file is not found, can not be read or any other 505 OS related error. 506 506 507 507 JError if there was a runtime exception thrown by the underlying … … 566 566 567 567 if _py_handle_exception(ex, jpype.java.io.FileNotFoundException): 568 raise IOError(568 raise OSError( 569 569 '\nMessage: '+ex.message().encode('utf-8')+\ 570 570 '\nStacktrace: '+ex.stacktrace().encode('utf-8')) 571 571 572 572 if _py_handle_exception(ex, jpype.java.io.IOException): 573 raise IOError(573 raise OSError( 574 574 '\nMessage: '+str(ex.message().encode('utf-8'))+\ 575 575 '\nStacktrace: '+str(ex.stacktrace().encode('utf-8')))
Note: See TracChangeset
for help on using the changeset viewer.