diff --git a/plugins/PluginBrowser/PluginBrowser.py b/plugins/PluginBrowser/PluginBrowser.py index 49405c4272..ee1b8906da 100644 --- a/plugins/PluginBrowser/PluginBrowser.py +++ b/plugins/PluginBrowser/PluginBrowser.py @@ -100,9 +100,16 @@ class PluginBrowser(QObject, Extension): if new_progress == 100.0: self.setIsDownloading(False) self._download_plugin_reply.downloadProgress.disconnect(self._onDownloadPluginProgress) - self._temp_plugin_file = tempfile.NamedTemporaryFile(suffix = ".curaplugin") - self._temp_plugin_file.write(self._download_plugin_reply.readAll()) + + # must not delete the temporary file on Windows + self._temp_plugin_file = tempfile.NamedTemporaryFile(mode = "w+b", suffix = ".curaplugin", delete = False) location = self._temp_plugin_file.name + + # write first and close, otherwise on Windows, it cannot read the file + self._temp_plugin_file.write(self._download_plugin_reply.readAll()) + self._temp_plugin_file.close() + + # open as read if not location.startswith("/"): location = "/" + location # Ensure that it starts with a /, as otherwise it doesn't work on windows. result = PluginRegistry.getInstance().installPlugin("file://" + location)