Skip to content

Commit

Permalink
_winreg in python3 has been changed to winreg. Update imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwhiting committed Oct 21, 2020
1 parent c4c20eb commit 0add364
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion DeDRM_plugin/ignoblekey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion DeDRM_plugin/kindlekey.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ def decode(data,map):
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
Expand Down
2 changes: 1 addition & 1 deletion DeDRM_plugin/simpleprefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, target, description):
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
Expand Down
8 changes: 4 additions & 4 deletions Obok_plugin/obok/legacy_obok.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def plist_to_dictionary(self, filename):

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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Other_Tools/Kobo/obok.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def __init__ (self, serials = [], device_path = None):
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/ ')
Expand Down

0 comments on commit 0add364

Please sign in to comment.