diff -r 3257703e10c5 -r 9978016560ec eric6/MicroPython/MicroPythonGraphWidget.py --- a/eric6/MicroPython/MicroPythonGraphWidget.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/MicroPython/MicroPythonGraphWidget.py Wed Oct 14 17:50:39 2020 +0200 @@ -317,10 +317,9 @@ fileName = "{0}.csv".format(time.strftime("%Y%m%d-%H%M%S")) fullPath = os.path.join(dataDir, fileName) try: - csvFile = open(fullPath, "w") - csvWriter = csv.writer(csvFile) - csvWriter.writerows(self.__rawData) - csvFile.close() + with open(fullPath, "w") as csvFile: + csvWriter = csv.writer(csvFile) + csvWriter.writerows(self.__rawData) self.__dirty = False return True