Jump to content

plist SyntaxError


Recommended Posts

Hey all Alfreds,


I have some strange behaviour here I can't explain, then I wouldn't be qualified to do so anyways:


Yesterday I updated one of my macs (A) to Ventura, the other (B) is still on Monterey. Both are running Alfred 5.0.3

(A) is running python 3.11, (B) 3.09


I have a workflow to log my working hours. It writes the hours to one text file per project. The current or most recent project names are stored in the workflows variables. I call python scripts in my workflow. 

Everything worked fine until yesterday: 

On both machines (synced via Dropbox) the workflow plist storing the variables can't be read anymore. 



Traceback (most recent call last):
  File "/Users/rf/Desktop/testFileOp.py", line 13, in <module>
    info = pl.load(fp)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/plistlib.py", line 864, in load
    if info['detect'](header):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/plistlib.py", line 410, in _is_fmt_xml
    if header.startswith(pfx):
TypeError: startswith first arg must be str or a tuple of str, not bytes


I can't tell if this has anything to do with Alfred 5.0.3 (Build 2087), don't recall when I did the update. Or Ventura (only one mac) or python 3.11 (again only one updated).

The plist of other workflows give me the same error. 


As hinted above, I don't really know what I am doing, but it worked until very recently and I don't find any similar posts here or documented changes in python.


Thanks for your help, for now I have to manually write my hours in that text doc, like an animal (!) - so really urgent.


Link to comment
Share on other sites

Thanks for the quick answer. I don't think it's this. The folders haven't changed, all files are there and up to date.

I can print(plist.read()) but not load(plist). So maybe it's not a Alfred problem unless something about the Alfred plists has changed and made them incompatible with plistlib.

Link to comment
Share on other sites

OK! Me, very stupid. Thanks for pointing me in the right direction:


with open(workflowPath + 'info.plist', 'wb') as fp:


wb like write-bytes! As required since python 3.4 or so. Must have changed that at some point during my "improvements".


Please close this embarrassing thread, there is no bug here, but me! 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...