alfred-homebrew
alfred-homebrew copied to clipboard
Not working in Monterey 12.3
Since I have updated to Monterey, I can't get the workflow to work anymore.
This is the error I receive:
Homebrew & Cask for Alfred[[Script Filter] Queuing argument ''
Homebrew & Cask for Alfred[[Script Filter] Script with argv '(null)' finished
ERROR: Homebrew & Cask for Alfred[[Script Filter]Code 127: /bin/bash: python: command not found
Hi @ismaelab, I'm afraid I can't look into this as I haven't upgraded to Monterey yet. Contributions are more than welcome!
Python2 was uninstalled in 12.3 Try reinstalling python2.
Reference: https://www.alfredapp.com/help/kb/python-2-monterey/
Python2 was uninstalled in 12.3 Try reinstalling python2.
Reference: https://www.alfredapp.com/help/kb/python-2-monterey/
Didn't solve the issue for me unfortunately.
I was able to get the workflow running with a workaround hope this helps
I am basically replacing the python command with the complete location of the python command since I am unable to get the python command working globally on mac
- Installing python 2 as suggested by @Sondho
- Go to the homebrew workflow and enable debug mode.
- Trigger the brew keyword in Alfred.
- If you are getting
Code 127: /bin/bash: python: command not founderror. - Open the script filter for brew and cask and change the script as follows
- From
python brew.py "{query}"to/Users/<your username>/.pyenv/shims/python brew.py "{query}" - Repeat for cask script filter
- Trigger the brew or cask keyword in Alfred again
- If you get
background.py:234 no file founderror - Open the background.py file from the location shown in the error
- Go to line 233 and replace
pythonwith/Users/<your username>/.pyenv/shims/python
Great job tracking down a solution. Followed the steps and can confirm that it is working on 12.3.1 I did have one small issue that was easily resolved. pyenv wasn't satisfied until I explicitly specified my python version.
For some reason it defaulted to 'system' on my machine.
I fixed it with pyenv global 2.7.18
@cryophobic Gald I helped.
Avoiding screenshots might be a start
💻😉 (sorry, the opportunity was too good)
Is there anything in https://github.com/fniephaus/alfred-homebrew/issues/52#issuecomment-1093658852 we can integrate into the workflow so that it's easier to set up Python 2 with pyenv or homebrew?
I don't know much about developing Alfred workflows, and even less about Python, so maybe this is a terrible idea, but...
Python3 executable is only 167kb, so I assume Python 2 is roughly the same size. Could you not package the exact version of python you need into the plugin itself and reference it directly? This would avoid the entire process of dealing with pyenv, shims, $PATH, system updates, etc.
The only hangup I would expect to see is MacOS Gatekeeper preventing the packaged python executable from running initially. But that seems like a far easier task to guide users around than installing pyenv.
Thoughts?
Please switch to python3, python2 is EOL and a security risk.
Bundling a language interpreter into an application is quite unusual and comes with more challenges than keeping just the executable size small.
I was able to get the workflow running with a workaround hope this helps
I am basically replacing the python command with the complete location of the python command since I am unable to get the python command working globally on mac
- Installing python 2 as suggested by @Sondho
- Go to the homebrew workflow and enable debug mode.
- Trigger the brew keyword in Alfred.
- If you are getting
Code 127: /bin/bash: python: command not founderror.- Open the script filter for brew and cask and change the script as follows
- From
python brew.py "{query}"to/Users/<your username>/.pyenv/shims/python brew.py "{query}"- Repeat for cask script filter
- Trigger the brew or cask keyword in Alfred again
- If you get
background.py:234 no file founderror- Open the background.py file from the location shown in the error
- Go to line 233 and replace
pythonwith/Users/<your username>/.pyenv/shims/python
I tried this solution under python 3.9 but failed. In the beginning, I can go through to step 8, but still did not solve. It did not hint step 9 ever. Even if I installed python 2.7.18, the debug shows "[Errno 2] No such file or directory". Any help would be appreciated in advance. Thx
I'm getting an error that the module cPickle is not found. In looking at the python code for the workflow.py file, there is a reference to cPickle. In the workflow3.py file there is no reference cPickle. This note is at the top of the workflow.py file, but I'm not sure which user manual I'm supposed to refer to:
"""The :class:Workflow object is the main interface to this library.
:class:Workflow is targeted at Alfred 2. Use
:class:~workflow.Workflow3 if you want to use Alfred 3's new
features, such as :ref:workflow variables <workflow-variables> or
more powerful modifiers.
See :ref:setup in the :ref:user-manual for an example of how to set
up your Python script to best utilise the :class:Workflow object.
Can someone point me to the right material?
Regarding Line 9: "background.py:234 no file found error"
One can completely disable run_in_background because there is no point of updating the workflow (actually should not run autoupdate) if it's unmaintained and users need to make a local patch to make this workflow with damn python 2.
# Call this script
cmd = ['/usr/bin/python', __file__, name]
_log().debug('[%s] passing job to background runner: %r', name, cmd)
- retcode = subprocess.call(cmd)
+ retcode = -1
if retcode: # pragma: no cover
_log().error('[%s] background runner failed with %d', name, retcode)
else:
_log().debug('[%s] background job started', name)
Adding to the solution from @hdecoded (which worked out great, thank you!) Specifying python 2 for the scripts of that workflow alone might save one from having to set them as the global python version (assuming you're using pyenv):
/Users/<