From 0add3646d91cdcb9420cfe6cdbcaae467e429a1f Mon Sep 17 00:00:00 2001 From: Jeremy Whiting Date: Wed, 21 Oct 2020 10:43:54 -0600 Subject: [PATCH] _winreg in python3 has been changed to winreg. Update imports. --- DeDRM_plugin/ignoblekey.py | 2 +- DeDRM_plugin/kindlekey.py | 1 - DeDRM_plugin/simpleprefs.py | 2 +- Obok_plugin/obok/legacy_obok.py | 8 ++++---- .../DRM_Key_Scripts/Adobe_Digital_Editions/adobekey.pyw | 2 +- .../DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekey.pyw | 2 +- .../DRM_Key_Scripts/Kindle_for_Mac_and_PC/kindlekey.pyw | 2 +- Other_Tools/Kobo/obok.py | 2 +- .../Tetrachroma_FileOpen_ineptpdf/ineptpdf_8.4.51.pyw | 2 +- 9 files changed, 11 insertions(+), 12 deletions(-) diff --git a/DeDRM_plugin/ignoblekey.py b/DeDRM_plugin/ignoblekey.py index 646a64e..5e33e33 100644 --- a/DeDRM_plugin/ignoblekey.py +++ b/DeDRM_plugin/ignoblekey.py @@ -95,7 +95,7 @@ def getNookLogFiles(): logFiles = [] found = False if iswindows: - import _winreg as winreg + import winreg # some 64 bit machines do not have the proper registry key for some reason # or the python interface to the 32 vs 64 bit registry is broken diff --git a/DeDRM_plugin/kindlekey.py b/DeDRM_plugin/kindlekey.py index 4b880fc..808b1b7 100644 --- a/DeDRM_plugin/kindlekey.py +++ b/DeDRM_plugin/kindlekey.py @@ -190,7 +190,6 @@ if iswindows: create_unicode_buffer, create_string_buffer, CFUNCTYPE, addressof, \ string_at, Structure, c_void_p, cast - # import _winreg as winreg import winreg MAX_PATH = 255 kernel32 = windll.kernel32 diff --git a/DeDRM_plugin/simpleprefs.py b/DeDRM_plugin/simpleprefs.py index 34aa6dc..65f2b59 100644 --- a/DeDRM_plugin/simpleprefs.py +++ b/DeDRM_plugin/simpleprefs.py @@ -20,7 +20,7 @@ class SimplePrefs(object): self.file2key[filename] = key self.target = target + 'Prefs' if sys.platform.startswith('win'): - import _winreg as winreg + import winreg regkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\") path = winreg.QueryValueEx(regkey, 'Local AppData')[0] prefdir = path + os.sep + self.target diff --git a/Obok_plugin/obok/legacy_obok.py b/Obok_plugin/obok/legacy_obok.py index f105688..caf24f2 100644 --- a/Obok_plugin/obok/legacy_obok.py +++ b/Obok_plugin/obok/legacy_obok.py @@ -37,14 +37,14 @@ class legacy_obok(object): def __oldcookiedeviceid(self): '''Optionally attempt to get a device id using the old cookie method. - Must have _winreg installed on Windows machines for successful key retrieval.''' + Must have winreg installed on Windows machines for successful key retrieval.''' wsuid = '' pwsdid = '' try: if sys.platform.startswith('win'): - import _winreg - regkey_browser = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\\Kobo\\Kobo Desktop Edition\\Browser') - cookies = _winreg.QueryValueEx(regkey_browser, 'cookies') + import winreg + regkey_browser = winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Software\\Kobo\\Kobo Desktop Edition\\Browser') + cookies = winreg.QueryValueEx(regkey_browser, 'cookies') bytearrays = cookies[0] elif sys.platform.startswith('darwin'): prefs = os.path.join(os.environ['HOME'], 'Library/Preferences/com.kobo.Kobo Desktop Edition.plist') diff --git a/Other_Tools/DRM_Key_Scripts/Adobe_Digital_Editions/adobekey.pyw b/Other_Tools/DRM_Key_Scripts/Adobe_Digital_Editions/adobekey.pyw index 7fbd516..bc33567 100644 --- a/Other_Tools/DRM_Key_Scripts/Adobe_Digital_Editions/adobekey.pyw +++ b/Other_Tools/DRM_Key_Scripts/Adobe_Digital_Editions/adobekey.pyw @@ -129,7 +129,7 @@ if iswindows: c_long, c_ulong from ctypes.wintypes import LPVOID, DWORD, BOOL - import _winreg as winreg + import winreg def _load_crypto_libcrypto(): from ctypes.util import find_library diff --git a/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekey.pyw b/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekey.pyw index 98ae209..7365c94 100644 --- a/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekey.pyw +++ b/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekey.pyw @@ -98,7 +98,7 @@ def getNookLogFiles(): logFiles = [] found = False if iswindows: - import _winreg as winreg + import winreg # some 64 bit machines do not have the proper registry key for some reason # or the python interface to the 32 vs 64 bit registry is broken diff --git a/Other_Tools/DRM_Key_Scripts/Kindle_for_Mac_and_PC/kindlekey.pyw b/Other_Tools/DRM_Key_Scripts/Kindle_for_Mac_and_PC/kindlekey.pyw index e20b7c9..4837627 100644 --- a/Other_Tools/DRM_Key_Scripts/Kindle_for_Mac_and_PC/kindlekey.pyw +++ b/Other_Tools/DRM_Key_Scripts/Kindle_for_Mac_and_PC/kindlekey.pyw @@ -177,7 +177,7 @@ if iswindows: create_unicode_buffer, create_string_buffer, CFUNCTYPE, addressof, \ string_at, Structure, c_void_p, cast - import _winreg as winreg + import winreg MAX_PATH = 255 kernel32 = windll.kernel32 advapi32 = windll.advapi32 diff --git a/Other_Tools/Kobo/obok.py b/Other_Tools/Kobo/obok.py index fc0cabf..98608c5 100644 --- a/Other_Tools/Kobo/obok.py +++ b/Other_Tools/Kobo/obok.py @@ -346,7 +346,7 @@ class KoboLibrary(object): if (self.kobodir == u""): # step 4. we haven't found a device with serials, so try desktop apps if sys.platform.startswith('win'): - import _winreg as winreg + import winreg if sys.getwindowsversion().major > 5: if 'LOCALAPPDATA' in os.environ.keys(): # Python 2.x does not return unicode env. Use Python 3.x diff --git a/Other_Tools/Tetrachroma_FileOpen_ineptpdf/ineptpdf_8.4.51.pyw b/Other_Tools/Tetrachroma_FileOpen_ineptpdf/ineptpdf_8.4.51.pyw index 6277c50..7a0dcd8 100644 --- a/Other_Tools/Tetrachroma_FileOpen_ineptpdf/ineptpdf_8.4.51.pyw +++ b/Other_Tools/Tetrachroma_FileOpen_ineptpdf/ineptpdf_8.4.51.pyw @@ -2290,7 +2290,7 @@ class PDFDocument(object): import win32api import win32security import win32file - import _winreg as winreg + import winreg except: raise ADEPTError('PyWin Extension (Win32API module) needed.\n'+\ 'Download from http://sourceforge.net/projects/pywin32/files/ ')