alfred-searchio
alfred-searchio copied to clipboard
No longer works in macOS 12.3
Since Apple removed Python2... :'(
Fyi for anyone stumbling upon this, i got it to work after jumping through some hoops:
- installed python2, see https://www.alfredapp.com/help/kb/python-2-monterey/ (and https://www.alfredapp.com/blog/guides-and-tutorials/python-2-workflows-on-macos-monterey-12-3/ )
- added
export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
as first line to all theScript Filters
andRun Script
actions in the workflow - some of the scripts in the workflow have a hardcoded path to
/usr/bin/python
which needs to be changed to/opt/homebrew/bin/python
- had to sign the
search
binary in the Workflow dir withcodesign -f -s - ./searchio
Great workflow by the way!
There's also an issue in the "import search" functionality here.
To work around it, you can comment out all the lines in lib/searchio/cmd/web.py
from 119 to 142 (as a result, open browser windows will no longer be found.) Also delete web.pyc
.
You can then just copy the search url you want to import to the clipboard instead.
The bug details/error message:
13:02:57 workflow.py:2055 DEBUG ---------- Searchio! (2.0.1) ----------
13:02:57 workflow.py:1462 DEBUG reading settings from /Users/david/Library/Application Support/Alfred/Workflow Data/net.deanishe.alfred-searchio/settings.json
13:02:57 workflow.py:2339 DEBUG update check not due
13:02:57 cli.py:63 DEBUG args={'--help': False,
'--version': False,
'<args>': [''],
'<command>': 'web'}
execution error: Error: Error: Application can't be found. (-2700)
13:02:57 workflow.py:2074 ERROR Command '['/usr/bin/osascript', '-l', 'JavaScript', '-e', '\nfunction run(argv) {\n var apps = {};\n argv.forEach(function(name) {\n if (Application(name).running()) {\n apps[name] = true;\n } else {\n apps[name] = false;\n }\n });\n return JSON.stringify(apps);\n}\n', 'Google Chrome', 'Safari']' returned non-zero exit status 1
Traceback (most recent call last):
File "/Users/david/Alfred.alfredpreferences/workflows/user.workflow.71B242C7-E9EC-4031-B192-5E5A39D09BBD/lib/workflow/workflow.py", line 2067, in run
func(self)
File "/Users/david/Alfred.alfredpreferences/workflows/user.workflow.71B242C7-E9EC-4031-B192-5E5A39D09BBD/lib/searchio/cli.py", line 127, in cli
return run(wf, argv)
File "/Users/david/Alfred.alfredpreferences/workflows/user.workflow.71B242C7-E9EC-4031-B192-5E5A39D09BBD/lib/searchio/cmd/web.py", line 212, in run
return do_get_url(wf, args)
File "/Users/david/Alfred.alfredpreferences/workflows/user.workflow.71B242C7-E9EC-4031-B192-5E5A39D09BBD/lib/searchio/cmd/web.py", line 122, in do_get_url
output = subprocess.check_output(cmd)
File "/Users/david/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['/usr/bin/osascript', '-l', 'JavaScript', '-e', '\nfunction run(argv) {\n var apps = {};\n argv.forEach(function(name) {\n if (Application(name).running()) {\n apps[name] = true;\n } else {\n apps[name] = false;\n }\n });\n return JSON.stringify(apps);\n}\n', 'Google Chrome', 'Safari']' returned non-zero exit status 1
13:02:57 workflow.py:2076 INFO for assistance, see: https://github.com/deanishe/alfred-searchio/issues
13:02:57 workflow.py:2097 DEBUG ---------- finished in 0.046s ----------
any chance you would throw up a fork with those changes?
Hi @benbernard , i haven't actually changed the source files in the repo, only the resulting workflow. I don't have enough knowledge/time to do that (easily) and build the whole thing. Besides, it's just an ugly workaround, what needs to happen is someone who knows python needs to "update" the code to python3 (and I expect that would be relatively easy if python is your thing...)
Anyways, i've exported my workflow and you can fetch it here.. Hopefully it will work for you, i might have changed some keywords you need to change. Hope that helps :-)
Hello @notDavid . A problem I am facing (even with your workflow) is that it shows "no such file or directory", may I know how would you fix that? Thanks!
@kongpuishun I'm not sure, i would try deleting ddg
in the screenshot above, and then in Alfred type searchio
to go to the Searchio settings and add new search engines.
Hi @notDavid , I'm not able open the searchio setting for some reason. It disappears after I hit enter. The search is working fine for the previously added engines though. Any idea about how I should resolve this?
@rishraj I don't know... but you can try opening the Workflow in Alfred and toggling "Debug mode" and see what errors you get, and see if that helps you in solving it.
[13:57:05.598] Logging Started... [13:57:20.294] Searchio![Script Filter] Queuing argument '' [13:57:21.030] Searchio![Script Filter] Script with argv '' finished [13:57:21.033] ERROR: Searchio![Script Filter] Code 127: env: python: No such file or directory
Need to be updated.