giovanni Posted April 16, 2021 Share Posted April 16, 2021 hi all I can't get this to work if launched from Alfred. Works if run from Terminal. What am I missing? thanks!! #!/usr/bin/env python import os if not os.path.exists(os.path.expanduser('~/Library/Application Support/Alfred/Workflow Data/myWorkflow')): os.mkdir (os.path.expanduser('~/Library/Application Support/Alfred/Workflow Data/myWorkflow')) Link to comment
deanishe Posted April 16, 2021 Share Posted April 16, 2021 What does the debugger tell you the error is? FWIW, I'd switch to Python 3 now if I were you on account of Python 2 being dead. Then you can just do os.makedirs(os.path.expanduser('~/...'), exist_ok=True) giovanni 1 Link to comment
giovanni Posted April 16, 2021 Author Share Posted April 16, 2021 thanks. nothing in the debugger (but I might not be redirecting errors to it?). I tried the Python 3 solution and it's the same (works in Terminal, nothing in Alfred). I thought Python 2 was recommended if you wanted to share (for users on older systems), but perhaps it is time to switch? thanks! PS: that's what I get for not using your Workflow which has always created those directories seamlessly Link to comment
deanishe Posted April 16, 2021 Share Posted April 16, 2021 11 minutes ago, giovanni said: I thought Python 2 was recommended if you wanted to share (for users on older systems) Sure. But if you want a workflow that will continue to work on future systems, use Python 3. Python 2 is dead. Regardless of any other qualities of the language, that makes it a questionable choice for new code. giovanni 1 Link to comment
giovanni Posted April 16, 2021 Author Share Posted April 16, 2021 update: this issue appears to be Big Sur-specific, as the workflow creates the directory in Catalina. Link to comment
deanishe Posted April 16, 2021 Share Posted April 16, 2021 Might be Alfred permissions, then? Does Alfred have full-disk access? Link to comment
giovanni Posted April 16, 2021 Author Share Posted April 16, 2021 it didn't, but granting permission did not make a difference. Also, in Catalina Alfred is not even on the list of apps requesting Full Disk Access... and how has Workflow been doing it? I have been using Workflow on Big Sur for a while without issues... I will keep investigating. May I ask how to direct Python's error messages to Alfred's debugger? is it by adding >&2 somewhere? Link to comment
deanishe Posted April 16, 2021 Share Posted April 16, 2021 6 hours ago, giovanni said: May I ask how to direct Python's error messages to Alfred's debugger? They should appear there automatically as Python writes fatal errors to STDERR. Link to comment
giovanni Posted April 23, 2021 Author Share Posted April 23, 2021 for future reference: this seemed to be related to Google Drive, I was running this workflow from a symlinked folder in google drive (I know, it's a no-no ). From that same source it worked correctly on catalina and incorrectly on big sur. Works fine on both, if symlinked from a regular folder. thanks again! deanishe 1 Link to comment
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