eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py

changeset 7785
9978016560ec
parent 7775
4a1db75550bd
child 7836
2f0d208b8137
diff -r 3257703e10c5 -r 9978016560ec eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py	Wed Oct 14 17:50:39 2020 +0200
@@ -274,9 +274,8 @@
         self.__noFrames = False
         
         try:
-            f = open(self.__fileName, "r", encoding="utf-8")
-            fileData = f.read()
-            f.close()
+            with open(self.__fileName, "r", encoding="utf-8") as f:
+                fileData = f.read()
         except (IOError, OSError):
             # silently ignore because it shouldn't happen
             return

eric ide

mercurial