Fix python2 issues in Kindle and Nook code (#355)

This commit is contained in:
NoDRM
2023-06-24 09:53:55 +02:00
parent a553a71f45
commit f86cff285b
4 changed files with 21 additions and 4 deletions

View File

@@ -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):