jeeftor / EmojiTaco

Alfred Emoji Script with Taco and other unicode 9 emoji
78 stars 3 forks source link

No longer works OOB on macOS 12.3 #27

Closed querkmachine closed 2 years ago

querkmachine commented 2 years ago

Emoji Taco v1.2.3 — macOS 12.3 beta.

I've just updated to the macOS 12.3 beta that dropped a couple of days ago (I live dangerously) and Emoji Taco no longer works. No errors or glitches, anything after the initial Alfred keywords (aka, involves running a python script) just doesn't work.

My assumption is that this is because macOS 12.3 removes the bundled version of Python 2 (something Apple apparently said they were going to do in 2019). Bit weird of them to do that in a minor release, but that's Apple for ya.

Just giving a head's up in case no one has pointed this out yet!

jeeftor commented 2 years ago

We’ll that could def be the problem!!! It’s on my todo list to look at this. There is just so much other stuff going on. Maybe I can take a look this evening

Sent from my iPhone

On Jan 31, 2022, at 2:53 AM, Kimberly Grey @.***> wrote:

 Emoji Taco v1.2.3 — macOS 12.3 beta.

I've just updated to the macOS 12.3 beta that dropped a couple of days ago (I live dangerously) and Emoji Taco no longer works. No errors or glitches, anything after the initial Alfred keywords (aka, involves running a python script) just doesn't work.

My assumption is that this is because macOS 12.3 removes the bundled version of Python 2 (something Apple apparently said they were going to do in 2019). Bit weird of them to do that in a minor release, but that's Apple for ya.

Just giving a head's up in case no one has pointed this out yet!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

jeeftor commented 2 years ago

So I'm on 12.1

image

What do you have for python --version ?

jeeftor commented 2 years ago

I'm assuming 2 possible things:

jeeftor commented 2 years ago

So obviously Python3 isn't playing nice yet with the "stuff" ...

image
querkmachine commented 2 years ago

Running python --version returns "command not found", which seems consistent with it having been removed.

I do have Python 3 installed (python3 --version returns 3.8.9), though my understanding (as per the article linked in the initial issue) is that this is only going to be true for people with Xcode installed, and it isn't enabled otherwise.

jeeftor commented 2 years ago

So you are saying that out of the box the latest beta doesn't have any python? Or only has python3? I mean that's going to be a huger Alfred issue all together...

jeeftor commented 2 years ago

So I'm using this library: https://github.com/deanishe/alfred-workflow which hasn't been updated to Python3.... but I'm still confused about the beta osx situation with which python is available

LampPrinter commented 2 years ago

Not sure if this would help. But have a look. https://github.com/NorthIsUp/alfred-workflow-py3

ilikepeaches commented 2 years ago

Please see https://www.alfredapp.com/help/kb/python-2-monterey/

Installing python 2 via these instructions still results in "python: command not found" errors in the debugging console for the workflow.

Changing "python" in the three script filters to "/usr/local/bin/python" (i.e. to hardcode the newly Homebrew-installed python 2.7 binary) gives this set of errors:

[00:36:12.287] ERROR: Emoji Taco[Script Filter] Code 1: .
00:36:12 workflow.py:2055 DEBUG    ---------- Emoji Taco (1.2.3) ----------
00:36:12 workflow.py:1663 DEBUG    saved data: /Users/ilikepeaches/Library/Application Support/Alfred/Workflow Data/org.jeef.emoji/download_percent.cpickle
00:36:12 workflow.py:1663 DEBUG    saved data: /Users/ilikepeaches/Library/Application Support/Alfred/Workflow Data/org.jeef.emoji/phase.cpickle
00:36:12 workflow.py:1663 DEBUG    saved data: /Users/ilikepeaches/Library/Application Support/Alfred/Workflow Data/org.jeef.emoji/emoji_count.cpickle
00:36:12 background.py:233 DEBUG    [bg] command cached: /Users/ilikepeaches/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/org.jeef.emoji/bg.argcache
00:36:12 background.py:237 DEBUG    [bg] passing job to background runner: [u'/usr/bin/python', '/Users/ilikepeaches/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DC274ADB-8DD2-4A6E-B666-01417B55E331/src/workflow/background.pyc', 'bg']
00:36:12 workflow.py:2074 ERROR    [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/Users/ilikepeaches/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DC274ADB-8DD2-4A6E-B666-01417B55E331/src/workflow/workflow.py", line 2067, in run
    func(self)
  File "src/downloadDataFiles.py", line 83, in main
    run_in_background('bg', ['/usr/bin/python', wf.workflowfile('src/bg_downloader.py')])
  File "/Users/ilikepeaches/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DC274ADB-8DD2-4A6E-B666-01417B55E331/src/workflow/background.py", line 238, in run_in_background
    retcode = subprocess.call(cmd)
  File "/Users/ilikepeaches/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 172, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/Users/ilikepeaches/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/Users/ilikepeaches/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
jeeftor commented 2 years ago

Looks like the background download script is still calling /usr/bin/python ... I'm just a bunch of versions behind on the Mac .... hopefully the next version of Alfred will come out soon. I'll look into this but it could be the underlying lib I'm using that is providing python stuff. I tried the py3 upgrade on it and it didn't go as planned....

ilikepeaches commented 2 years ago

I got it mostly working by

  1. Installing python 2.7 per these instructions: https://www.alfredapp.com/help/kb/python-2-monterey/
  2. Changing "python" in the three script filters to "/usr/local/bin/python"
  3. Performing a search-and-replace of all files in the workflow bundle: search for all instances of "/usr/bin/python" and replace with "/usr/local/bin/python"

Init Emoji says that it parses 2,243 emoji, and many searches work as expected:

Screen Shot 2022-02-08 at 6 48 54 PM

but there are some obvious ones now missing?

Screen Shot 2022-02-08 at 6 46 08 PM

Hmm.

I don't see anything in the debug output that stands out.

ilikepeaches commented 2 years ago

Ah. I see that the no-peach issue is a separate one: https://github.com/jeeftor/EmojiTaco/issues/24

vitorgalvao commented 2 years ago

@jeeftor Go into your three script filters and make the first line:

export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"

That won’t make a difference to anyone using the Workflow now, and for people who are on Monterey 12.3 and followed the knowledge base article, it will work as well.

ilikepeaches commented 2 years ago

Unfortunately, that updated PATH won't fix the workflow by itself because several hardcoded references to /usr/bin/python remain:

Screen Shot 2022-02-09 at 11 41 37 AM

@jeeftor if you add the PATH to the script filters per @vitorgalvao and change each of those seven '/usr/bin/python' instances to just 'python' (you don't want to hardcode e.g. /usr/local/bin/python because Homebrew only installs in that location on Intel; on M1 the binary will be at /opt/homebrew/bin/python), then the script works, https://github.com/jeeftor/EmojiTaco/issues/24 notwithstanding.

godbout commented 2 years ago

just installed 12.3. sacrebleu. missing my tacos emojis.

edit: this was supposed to contain the frown emoji but hey. edit2: many stuff on my machine are broken now and i fork and update them myself to Python3 but this one is :grimace:

jeeftor commented 2 years ago

Sorry guys -> I've been way behind working on other projects... :(

And my version keeps working and working... (so its hard to debug this stuff)

On Tue, Mar 15, 2022 at 4:42 AM G. @.***> wrote:

just installed 12.3. sacrebleu. missing my tacos emojis.

— Reply to this email directly, view it on GitHub https://github.com/jeeftor/EmojiTaco/issues/27#issuecomment-1067831340, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRQ4XZ2Z5R5NNUW4ZTK4RDVABSS7ANCNFSM5NFYRRVQ . You are receiving this because you were mentioned.Message ID: @.***>

vitorgalvao commented 2 years ago

And my version keeps working and working... (so its hard to debug this stuff)

There’s nothing to debug; it’s not a problem with your code but with the tooling it relies on. The Workflow will break for everyone on 12.3—including you—because the Python runtime is no longer present. For the Workflow to keep working you’ll have to either do the changes I and @ilikepeaches pointed out above (like so[^1]) and instruct people to install Python2 or port the Workflow to Python3 (or another language).

[^1]: Untested, but should work. It’s a temporary host because the Workflow is massive and GitHub complains about it.

godbout commented 2 years ago

Sorry guys -> I've been way behind working on other projects... :( And my version keeps working and working... (so its hard to debug this stuff)

no worries man. if i get a bit better at Python i'll have a look. thanks again for the tacos!

jeeftor commented 2 years ago

I just ordered a new Mac today (6-8 weeks) -> so I'll likely have to fix this automation when it arrives...

So at least thats on the horizon. So I promise it will eventually get done as soon as it stops working for me

jeeftor commented 2 years ago

I lied ... i'm working on the code a bit today - but no promises

jeeftor commented 2 years ago

Probably wont be done today but i've got a py3 branch that i'm working on locally (outside of alfred) with only python3 so I've been porting thigs over. Decided to do a big code cleanup while I'm at it (well medium)...

And running into a few python 2-3 issues :)

jeeftor commented 2 years ago

So I have the code now running with python3 BUT python3 handles unicode / emojis differently so I need to dig through that. Also making a ton of improvements that probably none of you guys care about like adding more comments and return types (totally for readability not for usefulness)

jeeftor commented 2 years ago

https://github.com/jeeftor/EmojiTaco/releases/tag/py3

I haven't really had time to test this so its a crapshoot - but in theory it might kinda work

godbout commented 2 years ago

Also making a ton of improvements that probably none of you guys care about like adding more comments and return types (totally for readability not for usefulness)

are you kidding. clean and tight code is sexy af. 😍

jeeftor commented 2 years ago

I realized I forgot to update the script commands Alfred actually calls ... oops

jeeftor commented 2 years ago

Need to set pythonpath I think and python3 in the scripts if you are so motivated. I'll try tomorrow

jeeftor commented 2 years ago

So if somebody feels like testing stuff - I think your script commands need to look something like this:

SEARCH TASK

 PYTHONPATH=$(pwd)/src/libs python3 src/esearch.py taco

INIT TASK

# No longer needed probably
# find . -name '*.so' | xargs xattr -d -r com.apple.quarantine
 PYTHONPATH=$(pwd)/src/libs python3 src/downloadDataFiles.py 

for your execution script on the search call for example

One caveat which may / may not cause issues:

In the background downloading script I'm calling /usr/bin/python3 so I'll need some folks to verify thats legit as well.

image
vitorgalvao commented 2 years ago

In the background downloading script I'm calling /usr/bin/python3 so I'll need some folks to verify thats legit as well.

If you’re using an unmodified alfred-workflow Python library, it won’t work. That library only works with Python 2, not 3. See https://github.com/deanishe/alfred-workflow/issues/97 for more information, and some efforts towards porting it.

pat-s commented 2 years ago

@jeeftor https://github.com/lukewaite/alfred-gitlab/issues/27 might help. I've also successfully used it to port another workflow of mine to alfred-workflow using py3.

jeeftor commented 2 years ago

Can somebody try the version I pushed? I have a new system on order which will force the issue on my end :)

jeeftor commented 2 years ago

The scripts should by py3 compatible for the most part now I think

godbout commented 2 years ago

Can somebody try the version I pushed? I have a new system on order which will force the issue on my end :)

doesn't work in my case sorry. keep getting modules not found (cPickle, reload etc.). but maybe it's my setting. running Python 3.9.12. also my binary is python3, not python.

edit: just to precise. i've first tried by replacing python by python3 in the Alfred objects. it didn't work. then i've put back python and i've symlinked python to python3 just in case. but got the same results.

jeeftor commented 2 years ago

Ok good to know!

(I really wish I had my new mac so i could test this in a clean environment)

On Tue, Mar 29, 2022 at 8:13 AM G. @.***> wrote:

Can somebody try the version I pushed? I have a new system on order which will force the issue on my end :)

doesn't work in my case sorry. keep getting modules not found (cPickle, reload etc.). but maybe it's my setting. running Python 3.9.12. also my binary is python3, not python.

— Reply to this email directly, view it on GitHub https://github.com/jeeftor/EmojiTaco/issues/27#issuecomment-1081925187, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRQ4X6VQCPJ3MIVKTAMI7LVCMFZ7ANCNFSM5NFYRRVQ . You are receiving this because you were mentioned.Message ID: @.***>

godbout commented 2 years ago

wish i could help more but really i'm a turd in python. i'll help testing though (although not sure you can totally trust my reports 😬).

jeeftor commented 2 years ago

As soon as my new computer arrives - i probably have this fixed within 2-3 days since it will impact me directly :)

On Tue, Mar 29, 2022 at 9:45 AM G. @.***> wrote:

wish i could help more but really i'm a turd in python. i'll help testing though (although not sure you can totally trust my reports 😬).

— Reply to this email directly, view it on GitHub https://github.com/jeeftor/EmojiTaco/issues/27#issuecomment-1082043976, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRQ4X66CUUQPX74FNNUTADVCMQSTANCNFSM5NFYRRVQ . You are receiving this because you were mentioned.Message ID: @.***>

godbout commented 2 years ago

any place we can send you some donation to sponsor some coffee or beer or coke (hehe see what i did with the last one?) for your awesome work?

jeeftor commented 2 years ago

You can hit me here:

https://www.buymeacoffee.com/jeef

godbout commented 2 years ago

done. but i've sent some coins rather than hitting. i don't like violence. (ba dum tss.)

pat-s commented 2 years ago

I played around a bit and got basic search working. However I only get the unicode ascii returned and not the emoji - and the imgs are not downloaded. Leavings this to you :) But FWIW there is no python3 error anymore.

As you see I needed to copy and duplicate some files as the paths were not correct and the workflow module was not found. Just did it very dirty but you might want to clean up for prod :)

https://github.com/pat-s/EmojiTaco/tree/py3

To get it working, you can c/p the repo contents into your alfred workflow folder and it should behave as in the screenshot.

image

PS: I didn't understand why you would need a new mac for testing this. I think you only need to exchange python by python3 in the alfred script blocks and by this you should be able to make use of py3.

jeeftor commented 2 years ago

Good point. Mostly I need the motivation of it doesn’t work to siphon off time.

Maybe I’ll give it a go later today

Sent from my iPhone

On Apr 4, 2022, at 11:28 AM, Patrick Schratz @.***> wrote:

 I played around a bit and got basic search working. However I only get the unicode ascii returned and not the emoji - and the imgs are not downloaded. Leavings this to you :) But FWIW there is no python3 error anymore.

As you see I needed to copy and duplicate some files as the paths were not correct and the workflow module was not found. Just did it very dirty but you might want to clean up for prod :)

https://github.com/pat-s/EmojiTaco/tree/py3

To get it working, you can c/p the repo contents into your alfred workflow folder and it should behave as in the screenshot.

PS: I didn't understand why you would need a new mac for testing this. I think you only need to exchange python by python3 in the alfred script blocks and by this you should be able to make use of py3.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

godbout commented 2 years ago

PS: I didn't understand why you would need a new mac for testing this. I think you only need to exchange python by python3 in the alfred script blocks and by this you should be able to make use of py3.

extra motivation for when the stuff breaks for yourself 😅

jeeftor commented 2 years ago

Ya'll called me out ... I'll try to run with python3 on my local version :)

jeeftor commented 2 years ago

Updates ... the init emoji command seems messed up :(

jeeftor commented 2 years ago

It "appears" I'm running into some issues with the background runner -> so I may have to develop a new way in Python3 to download the data files...

pat-s commented 2 years ago

Thanks! This seems to coincide with my findings as the img/ files were not downloaded. Not sure how complicated a fix would be but I guess you can do it! 🚀

jeeftor commented 2 years ago

Update 1

I think I managed to get the BG script running - however - there is currently no GUI information on it which is pretty annoying

image
jeeftor commented 2 years ago

Update 2

Perhaps related to the 1st update - but in Python3 JSON text is displayed differently

image

So although these scripts work they might be pissing alfred off

jeeftor commented 2 years ago

Update 3

image

Looks like there were some bugs in the library update process so I'll probably pull that out for now which means ya'll have to manually update

jeeftor commented 2 years ago

I'll push out another test shortly ... its going to be a bit shall we say hacky - but it might work. The main issue is you will have to run init emoji and then just wait for many minutes - or manually view some log files to see when it completes...

I dont like that but its potentially where things are at right now 😠

jeeftor commented 2 years ago

ugh... looks like my release script also needs updates :(