--- a/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Mon Jun 20 13:25:14 2022 +0200 +++ b/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Mon Jun 20 19:47:39 2022 +0200 @@ -12,7 +12,7 @@ import pathlib from PyQt6.QtCore import ( - pyqtSignal, pyqtSlot, Qt, QObject, QTimer, QFile, QDir, QSettings, + pyqtSignal, pyqtSlot, Qt, QObject, QTimer, QDir, QSettings, QMetaObject, QUrl, Q_ARG, QCoreApplication ) from PyQt6.QtWidgets import QDialog @@ -233,7 +233,9 @@ self.__disabledScripts.append(fullName) collection = WebBrowserWindow.webProfile().scripts() - collection.remove(collection.findScript(fullName)) + foundScripts = collection.find(fullName) + if foundScripts: + collection.remove(foundScripts[0]) def addScript(self, script): """ @@ -271,13 +273,15 @@ fullName = script.fullName() collection = WebBrowserWindow.webProfile().scripts() - collection.remove(collection.findScript(fullName)) + foundScripts = collection.find(fullName) + if foundScripts: + collection.remove(foundScripts[0]) if fullName in self.__disabledScripts: self.__disabledScripts.remove(fullName) if removeFile: - QFile.remove(script.fileName()) + os.unlink(script.fileName()) del script self.scriptsChanged.emit() @@ -337,5 +341,7 @@ """ fullName = script.fullName() collection = WebBrowserWindow.webProfile().scripts() - collection.remove(collection.findScript(fullName)) + foundScripts = collection.find(fullName) + if foundScripts: + collection.remove(foundScripts[0]) collection.insert(script.webScript())