Skip to content

Instantly share code, notes, and snippets.

@ilius
Created June 21, 2023 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilius/30aa7a111de0f55dc6c33c499a1bb2d9 to your computer and use it in GitHub Desktop.
Save ilius/30aa7a111de0f55dc6c33c499a1bb2d9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import json
import sys
import biplist
plistPath = sys.argv[1]
try:
data = biplist.readPlist(plistPath)
except (biplist.InvalidPlistException, biplist.NotBinaryPlistException):
try:
import plistlib
with open(plistPath, mode="rb") as plist_file:
data = plistlib.loads(plist_file.read())
except Exception as e:
raise IOError(
"'Info.plist' file is malformed, "
f"Please provide 'Contents/' with a correct 'Info.plist'. {e}",
) from e
print(json.dumps(data, indent="\t", sort_keys=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment