Fix username code for Windows python 2

This commit is contained in:
Florian Bach 2022-05-14 14:59:14 +02:00
parent d88f0fc9a4
commit 03d8221cdc
1 changed files with 5 additions and 1 deletions

View File

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