From 03d8221cdc02adcfa1bf5e8e4c35bfc5a9ff96fe Mon Sep 17 00:00:00 2001 From: Florian Bach Date: Sat, 14 May 2022 14:59:14 +0200 Subject: [PATCH] Fix username code for Windows python 2 --- calibre-plugin/libadobe.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/calibre-plugin/libadobe.py b/calibre-plugin/libadobe.py index 2b59ac8..42bcca2 100644 --- a/calibre-plugin/libadobe.py +++ b/calibre-plugin/libadobe.py @@ -194,7 +194,11 @@ def makeSerial(random): except: # Windows uid = 1000 - username = os.getlogin().encode("utf-8").decode("latin-1") + try: + username = os.getlogin().encode("utf-8").decode("latin-1") + except: + import getpass + username = getpass.getuser().encode("utf-8").decode("latin-1") mac_address = get_mac_address()