PluginPyLint.py

changeset 89
8acd446fb6e6
parent 87
e0f8b96f4195
child 91
9dc14465123e
diff -r db1f004f14ca -r 8acd446fb6e6 PluginPyLint.py
--- a/PluginPyLint.py	Wed Oct 07 19:33:10 2020 +0200
+++ b/PluginPyLint.py	Wed Oct 14 19:46:35 2020 +0200
@@ -29,7 +29,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "7.1.0"
+version = "7.1.1"
 className = "PyLintPlugin"
 packageName = "PyLint"
 shortDescription = "Show the PyLint dialogs."
@@ -219,20 +219,17 @@
         _exePy3 = set()
         versionArgs = ["-c", "import sys; print(sys.version_info[0])"]
         for exe in exes:
-            try:
-                f = open(exe, "r")
+            with open(exe, "r") as f:
                 line0 = f.readline()
-                program = line0.replace("#!", "").strip()
-                process = QProcess()
-                process.start(program, versionArgs)
-                process.waitForFinished(5000)
-                # get a QByteArray of the output
-                versionBytes = process.readAllStandardOutput()
-                versionStr = str(versionBytes, encoding='utf-8').strip()
-                if versionStr == "3":
-                    _exePy3.add(exe)
-            finally:
-                f.close()
+            program = line0.replace("#!", "").strip()
+            process = QProcess()
+            process.start(program, versionArgs)
+            process.waitForFinished(5000)
+            # get a QByteArray of the output
+            versionBytes = process.readAllStandardOutput()
+            versionStr = str(versionBytes, encoding='utf-8').strip()
+            if versionStr == "3":
+                _exePy3.add(exe)
         
         executables = _exePy3
     

eric ide

mercurial