376 if res == E5MessageBox.Cancel: |
376 if res == E5MessageBox.Cancel: |
377 return |
377 return |
378 |
378 |
379 try: |
379 try: |
380 import codecs |
380 import codecs |
381 f = open(self.reportFile, 'wb') |
381 with open(self.reportFile, 'wb') as f: |
382 f.write(codecs.BOM_UTF8) |
382 f.write(codecs.BOM_UTF8) |
383 f.write(self.buf.encode('utf-8')) |
383 f.write(self.buf.encode('utf-8')) |
384 f.close() |
|
385 except IOError as why: |
384 except IOError as why: |
386 E5MessageBox.critical( |
385 E5MessageBox.critical( |
387 self, self.tr('PyLint Report'), |
386 self, self.tr('PyLint Report'), |
388 self.tr('<p>The PyLint report file <b>{0}</b> could not' |
387 self.tr('<p>The PyLint report file <b>{0}</b> could not' |
389 ' be written.<br>Reason: {1}</p>') |
388 ' be written.<br>Reason: {1}</p>') |