summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--DeDRM_plugin/ignoblekeyNookStudy.py17
-rw-r--r--DeDRM_plugin/kindlekey.py5
-rw-r--r--DeDRM_plugin/topazextract.py2
4 files changed, 21 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cdb0d6d..cb0ecbc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -91,3 +91,4 @@ List of changes since the fork of Apprentice Harper's repository:
- Support for Adobe's 'aes128-cbc-uncompressed' encryption method (fixes #242).
- Two bugfixes for Amazon DeDRM from Satuoni ( https://github.com/noDRM/DeDRM_tools/issues/315#issuecomment-1508305428 ) and andrewc12 ( https://github.com/andrewc12/DeDRM_tools/commit/d9233d61f00d4484235863969919059f4d0b2057 ) that might make the plugin work with newer versions.
- Fix font decryption not working with some books (fixes #347), thanks for the patch @bydioeds.
+- Fix a couple unicode errors for Python2 in Kindle and Nook code.
diff --git a/DeDRM_plugin/ignoblekeyNookStudy.py b/DeDRM_plugin/ignoblekeyNookStudy.py
index 6a5f1cf..4cf5246 100644
--- a/DeDRM_plugin/ignoblekeyNookStudy.py
+++ b/DeDRM_plugin/ignoblekeyNookStudy.py
@@ -54,15 +54,26 @@ def getNookLogFiles():
paths = set()
if 'LOCALAPPDATA' in os.environ.keys():
# Python 2.x does not return unicode env. Use Python 3.x
- path = winreg.ExpandEnvironmentStrings("%LOCALAPPDATA%")
+ if sys.version_info[0] == 2:
+ path = winreg.ExpandEnvironmentStrings(u"%LOCALAPPDATA%")
+ else:
+ path = winreg.ExpandEnvironmentStrings("%LOCALAPPDATA%")
if os.path.isdir(path):
paths.add(path)
if 'USERPROFILE' in os.environ.keys():
# Python 2.x does not return unicode env. Use Python 3.x
- path = winreg.ExpandEnvironmentStrings("%USERPROFILE%")+"\\AppData\\Local"
+ if sys.version_info[0] == 2:
+ path = winreg.ExpandEnvironmentStrings(u"%USERPROFILE%")+u"\\AppData\\Local"
+ else:
+ path = winreg.ExpandEnvironmentStrings("%USERPROFILE%")+"\\AppData\\Local"
+
if os.path.isdir(path):
paths.add(path)
- path = winreg.ExpandEnvironmentStrings("%USERPROFILE%")+"\\AppData\\Roaming"
+
+ if sys.version_info[0] == 2:
+ path = winreg.ExpandEnvironmentStrings(u"%USERPROFILE%")+u"\\AppData\\Roaming"
+ else:
+ path = winreg.ExpandEnvironmentStrings("%USERPROFILE%")+"\\AppData\\Roaming"
if os.path.isdir(path):
paths.add(path)
# User Shell Folders show take precedent over Shell Folders if present
diff --git a/DeDRM_plugin/kindlekey.py b/DeDRM_plugin/kindlekey.py
index 60a6065..14e4ed1 100644
--- a/DeDRM_plugin/kindlekey.py
+++ b/DeDRM_plugin/kindlekey.py
@@ -279,7 +279,10 @@ if iswindows:
path = ""
if 'LOCALAPPDATA' in os.environ.keys():
# Python 2.x does not return unicode env. Use Python 3.x
- path = winreg.ExpandEnvironmentStrings("%LOCALAPPDATA%")
+ if sys.version_info[0] == 2:
+ path = winreg.ExpandEnvironmentStrings(u"%LOCALAPPDATA%")
+ else:
+ path = winreg.ExpandEnvironmentStrings("%LOCALAPPDATA%")
# this is just another alternative.
# path = getEnvironmentVariable('LOCALAPPDATA')
if not os.path.isdir(path):
diff --git a/DeDRM_plugin/topazextract.py b/DeDRM_plugin/topazextract.py
index 1eaa2a5..8848bd9 100644
--- a/DeDRM_plugin/topazextract.py
+++ b/DeDRM_plugin/topazextract.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
+from __future__ import print_function
+
# topazextract.py
# Mostly written by some_updates based on code from many others