eric6/PluginManager/PluginInstallDialog.py

changeset 7785
9978016560ec
parent 7780
41420f82c0ac
child 7836
2f0d208b8137
--- a/eric6/PluginManager/PluginInstallDialog.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/PluginManager/PluginInstallDialog.py	Wed Oct 14 17:50:39 2020 +0200
@@ -464,18 +464,16 @@
                             d = os.path.dirname(outname)
                             if not os.path.exists(d):
                                 self.__makedirs(d)
-                            f = open(outname, "wb")
-                            f.write(zipFile.read(name))
-                            f.close()
+                            with open(outname, "wb") as f:
+                                f.write(zipFile.read(name))
                             self.__installedFiles.append(outname)
                 self.progress.setValue(tot)
                 # now compile user interface files
                 compileUiFiles(os.path.join(destination, packageName), True)
             else:
                 outname = os.path.join(destination, pluginFileName)
-                f = open(outname, "w", encoding="utf-8")
-                f.write(pluginSource)
-                f.close()
+                with open(outname, "w", encoding="utf-8") as f:
+                    f.write(pluginSource)
                 self.__installedFiles.append(outname)
         except os.error as why:
             self.__rollback()

eric ide

mercurial