bevesce/unicode-symbols-search

Support for MacOS 12.3?

andrehofmeyr opened this issue · 16 comments

Many thanks for this awesome workflow, I use it all the time.

Since updating to MacOS 12.3 it doesn't work though, because Apple no longer supports Python 2.7 :(

Is there an easy way to update the workflow to work with Python 3?

Cheers,
Andre

Hello I think I've got the same trouble…
Impossible to make it work
I got PHP 8.1.4 installed via homebrew and the workflow is set to /usr/local/bin/php
But it still doesn't work

I also use it all the time… thanks for your help

--- edit
I also install python via homebrew but it doesn't work neither

pnome commented

Same here. I really miss using this - it was so useful!

Python 2.7 via Homebrew alone will not work.

The steps here will keep this working: https://www.alfredapp.com/help/kb/python-2-monterey/

export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
eval "$(brew shellenv)"
brew install pyenv
pyenv install 2.7.18
ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "${HOMEBREW_PREFIX}/bin/python"

Tested today on fully updated Monterey 12.3 (SIP enabled).

This project is no longer maintained, still relying on python2.7. The above workaround of installing python2.7 is a good idea. Or consider switching to other similar workflow, such as https://github.com/deanishe/alfred-unicode/.

This project is no longer maintained, still relying on python2.7.
It's just a bit neglected, not not-maintained. I don't think that making authoritative statements like this out of nowhere is cool.

I'll look into this but my Mac can't be updated to Monterey, so I haven't had the issue myself.

I updated the script to work in python 3 too, but I don't have a way to actually test it on Monterey, so if any of you could check it out and let me know it would be great

@bevesce That's great to hear! Thanks a lot for the update. The workflow works well out-of-box on Monterey 12.3 for me. In my environment I do not have python2.

image

Although there is a subtle issue on escaping characters due to the bytes-vs-unicode difference, I think the workflow will work well if it's working on your development environment.

Many thanks @bevesce!

Unfortunately, it doesn't appear to be working for me:
image

This is exactly the error I've been getting since updating to 12.3, given that Python 2 no longer exists.

Worked for me too once I'd unlinked Python2:

rm "${HOMEBREW_PREFIX}/bin/python"
ln -s ~/.pyenv/versions/3.9.4/bin/python "${HOMEBREW_PREFIX}/bin/python"

Thanks for updating @bevesce !

@andrehofmeyr -- this may work:

export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
eval "$(brew shellenv)"
brew install pyenv
pyenv install 3.9.4
ln -s "${HOME}/.pyenv/versions/3.9.4/bin/python3" "${HOMEBREW_PREFIX}/bin/python"

@jplomas thanks for the suggestion, but I'm running the latest version of Python (3.10), and don't want 3.9.4 lying around. Strange that it works with 3.9.4 and not 3.10 🤷🏽‍♂️

Sadly I'm getting the same error trying to run the new workflow.

Unable to run task!

Reason: launch path not accessible

/usr/bin/python

Check that the selected language exists on your system.

If you're syncing Alfred's preferences, also check that all related workflow files exist locally.

Related Workflow Info...
Name: 'Unicode Symbols Search'
Folder:/Users/nathan/Dropbox/Maintenance/Systems/Alfred/Alfred.alfredpreferences/workflows/user.workflow.7C031774-C834-498A-BD76-FF9E1DE5BE79
0laus commented

Great workflow. Unfortunately I'm running in to the same issues as mentioned above.

For me, in order to make the workflow work I did the following:

  • install python 3, <3.10 (different install methods give different install locations)
  • copy the script inside alfred's interface into a file main_script.py at the root of the alfred workflow folder
  • add a shebang as the first line of the script, pointing to my python binary
    #!/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
    
  • give execution permissions with chmod +x main_script.py
  • in alfred, change Language to "External Script" and point to main_script.py in the text input below

@Sheraff 's solution is probably the most simple and stable one. I somehow make it works months before, and after updating to Monterey 12.5 yesterday, it doesn't work again. Turns out that making it into an external script is quite simple.

Seems recent Alfred allows for changing the script language to Python 3. Simply adjusting this within the Alfred workflow makes it work again. Yay!

Screen Shot 2022-08-31 at 20 34 56

DJF3 commented

I got it working with MacOS Ventura (13.4) and Alfred 3:

  • Install flow
  • Change "USS" script filter to (in my case) /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 symbolssearch.py "{query}"

Change the symbolssearch.py code:

  • line 3: from html import escape (was "from cgi import escape")
  • line 38: return ('<items>' + items + '</items>') (removed .encode)
  • line 57: query = ' '.join((s for s in sys.argv[1:])) (removed .decode part)
  • line 61: symbols = f.read().splitlines() (removed .decode)
  • line 71: print(r) (added brackets)

And now it works like a charm!