_Rf Posted November 1, 2022 Share Posted November 1, 2022 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. (A): 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 More sharing options...
Stephen_C Posted November 1, 2022 Share Posted November 1, 2022 13 minutes ago, _Rf said: On both machines (synced via Dropbox) There are two posts that might possibly help you: One from the developers of Alfred One solution discovered by another user Stephen Link to comment Share on other sites More sharing options...
_Rf Posted November 1, 2022 Author Share Posted November 1, 2022 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 More sharing options...
vitor Posted November 1, 2022 Share Posted November 1, 2022 The problem will be with the Python code. Alfred’s plists haven’t changed, and neither has the Python version shipping with Ventura (something else in the distribution might). Link to comment Share on other sites More sharing options...
_Rf Posted November 1, 2022 Author Share Posted November 1, 2022 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! Stephen_C 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now