From e20a7c7e63d0455f5000eb160aaeb8383a33894e Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Sun, 3 Nov 2019 22:44:08 -0800 Subject: [PATCH] When getting available license seats in Python 3, make sure data passed to FoundationPlist.readPlistFromString is a byte array. Addresses #957. --- code/client/munkilib/FoundationPlist.py | 2 +- code/client/munkilib/updatecheck/licensing.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/client/munkilib/FoundationPlist.py b/code/client/munkilib/FoundationPlist.py index 7e754b02..61a3f992 100644 --- a/code/client/munkilib/FoundationPlist.py +++ b/code/client/munkilib/FoundationPlist.py @@ -130,7 +130,7 @@ def writePlist(dataObject, filepath): def writePlistToString(rootObject): - '''Return 'rootObject' as a plist-formatted string.''' + '''Return 'rootObject' as a plist-formatted (byte)string.''' plistData, error = ( NSPropertyListSerialization. dataFromPropertyList_format_errorDescription_( diff --git a/code/client/munkilib/updatecheck/licensing.py b/code/client/munkilib/updatecheck/licensing.py index b7d5493f..f2d4dfb9 100644 --- a/code/client/munkilib/updatecheck/licensing.py +++ b/code/client/munkilib/updatecheck/licensing.py @@ -72,7 +72,8 @@ def update_available_license_seats(installinfo): try: license_data = fetch.getDataFromURL(url) display.display_debug1('Got: %s', license_data) - license_dict = FoundationPlist.readPlistFromString(license_data) + license_dict = FoundationPlist.readPlistFromString( + license_data.encode("UTF-8")) except fetch.Error as err: # problem fetching from URL display.display_error('Error from %s: %s', url, err)