Jump to content

Making Python 2 Workflows work on macOS Monterey 12.3 and above


Recommended Posts

On 3/28/2022 at 2:35 PM, vitor said:

Please ping me when you do, so I can link to it on the table as an alternative.

 

On 3/29/2022 at 11:24 PM, pankajsz said:

Yes, this one is better. I use AppleScript to extract highlights from skim pdf document. BTW, we need an update to this workflow for Monterey 12.3 Tried adding export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}" but need more updates.

 

Alfred PDF Tools v3 has just been released.

Edited by xilopaint
Link to comment
21 hours ago, 2pilvic said:

Is it possible to make this work too ?

 

Added.

 

45 minutes ago, kenanmike said:

this BetterDictionaries workflow below is not working.

 

That one isn’t simple to fix, because the Workflow programatically creates its own objects and it’s those which will need fixing. You’ll have to manually fix them or wait for a deeper fix to the Workflow itself.

Link to comment

Thanks for your reply @vitor

1 hour ago, vitor said:

 

Added.

 

 

That one isn’t simple to fix, because the Workflow programatically creates its own objects and it’s those which will need fixing. You’ll have to manually fix them or wait for a deeper fix to the Workflow itself.

I just factory reset the dictionaries, re-installed the workflow, and added the 1 line of script mentioned and it's now all working. Thanks again

Edited by kenanmike
Link to comment

Hi @emmanuel & @deanishe, I'm still having trouble with the ESV Bible workflow despite the update. 
I believed I've correctly installed Python 2 after the Monterey update:
"ln: /usr/local/bin/python: File exists"

But when I run the workflow I got the following debugging info...is it looking for python in the wrong place? I've been told not to mess around with changing python's location.
 

[10:24:35.666] ESV Online Bible[Script Filter] Queuing argument 'j'

[10:24:35.673] ESV Online Bible[Script Filter] Script with argv '(null)' finished

[10:24:35.675] ERROR: ESV Online Bible[Script Filter] Code 127: /bin/bash: line 1: python: command not found

[10:24:36.113] ESV Online Bible[Script Filter] Queuing argument 'jo'

[10:24:36.195] ESV Online Bible[Script Filter] Script with argv '(null)' finished

[10:24:36.200] ERROR: ESV Online Bible[Script Filter] Code 127: /bin/bash: line 1: python: command not found

[10:24:36.352] ESV Online Bible[Script Filter] Queuing argument 'joh'

[10:24:36.445] ESV Online Bible[Script Filter] Script with argv '(null)' finished

[10:24:36.449] ERROR: ESV Online Bible[Script Filter] Code 127: /bin/bash: line 1: python: command not found

[10:24:36.568] ESV Online Bible[Script Filter] Queuing argument 'john'

[10:24:36.575] ESV Online Bible[Script Filter] Script with argv '(null)' finished

[10:24:36.576] ERROR: ESV Online Bible[Script Filter] Code 127: /bin/bash: line 1: python: command not found

Edited by kenanmike
Link to comment
On 3/23/2022 at 3:05 AM, vitor said:

What’s the output of ls -la "${HOMEBREW_PREFIX}/bin/python"?

 

Hi @vitor, I'm getting the same error on a few workflows but in my case the second query you wrote yields the following result:
 

Quote

eval "$(brew shellenv)"

ls -la "${HOMEBREW_PREFIX}/bin/python"

lrwxr-xr-x  1 root  admin  15 11 Apr 21:49 /usr/local/bin/python -> /usr/bin/python


So am I right in thinking that means it has re-installed python 2 correctly but that it's in a location that the workflows aren't accessing? What can I do to correct this? 

Link to comment

@kenanmike I can’t say with that information if you installed Python correctly, only that the link isn’t correct. Try this:

 

rm /usr/local/bin/python
ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "/usr/local/bin/python"

 

If that doesn’t work, remove everything and try again.

 

Make sure to copy and paste the commands exactly. That link isn’t possible if you follow the instructions, so it has to be something unrelated you did.

Link to comment

Yes, that worked! That one step has got three workflows working for me again. Thanks again.

6 minutes ago, vitor said:

@kenanmike I can’t say with that information if you installed Python correctly, only that the link isn’t correct. Try this:

 

rm /usr/local/bin/python
ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "/usr/local/bin/python"

 

If that doesn’t work, remove everything and try again.

 

Make sure to copy and paste the commands exactly. That link isn’t possible if you follow the instructions, so it has to be something unrelated you did.

 

Link to comment

@vitorsaid I am not allowed to make new posts for this. So I will share my issue here. 

 

I followed the python install instructions and also reinstalled Git Repos from here: https://github.com/alfredapp/updated-third-party-python2-workflows (so it's on the list that things keep getting added to by folks' requests) however, it still does not work. This is what I get:

[10:01:27.495] Logging Started...
[10:01:36.064] ERROR: Git Repos[Script Filter] Code 1: Traceback (most recent call last):
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/repos.py", line 34, in <module>
    from workflow import Workflow3, ICON_WARNING, ICON_INFO
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/__init__.py", line 16, in <module>
    from .workflow import Workflow, manager
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/workflow.py", line 25, in <module>
    import cPickle
ModuleNotFoundError: No module named 'cPickle'
[10:01:36.180] ERROR: Git Repos[Script Filter] Code 1: Traceback (most recent call last):
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/repos.py", line 34, in <module>
    from workflow import Workflow3, ICON_WARNING, ICON_INFO
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/__init__.py", line 16, in <module>
    from .workflow import Workflow, manager
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/workflow.py", line 25, in <module>
    import cPickle
ModuleNotFoundError: No module named 'cPickle'
[10:01:36.353] ERROR: Git Repos[Script Filter] Code 1: Traceback (most recent call last):
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/repos.py", line 34, in <module>
    from workflow import Workflow3, ICON_WARNING, ICON_INFO
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/__init__.py", line 16, in <module>
    from .workflow import Workflow, manager
  File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/workflow.py", line 25, in <module>
    import cPickle
ModuleNotFoundError: No module named 'cPickle'

 

And @vitor said that, although some of them are on the list, "they may still be missing modules" and thus...may not work, and it may require the attention of the developer ( @deanishe). I am not sure if Deanishe is open to updating these (or already has?) but I know a lot of people use their workflows. 

 

Also @vitor can you help me understand why it's on that updated list if it's still not working? Maybe it should be moved to a special section ("updated for python fix but still doesnt work due to known issue, contact developer") rather than being listed alongside fixed stuff.

 

Is there an easy fix to the cPickle issue? I know cPickle was replaced by Pickle, tried changing that throughout the file as a last resort and no dice. 

 

Sorry if I am breaking 20 million forum rules or saying stuff that's against the etiquette rules here. It is frustrating when half of your workflows stop working. 

Link to comment
24 minutes ago, lehcar3 said:

can you help me understand why it's on that updated list if it's still not working?

 

I just tried it and it is working. Not sure why it’s not working for you. You said in the other post you tried “too many python fixing solutions and broke stuff”. Without knowing what you did, it’s going to be hard to help.


You can remove everything and try again, though that only undoes what the original instructions did; if you followed other guides on top of that, those might still be there.


Also, as I mentioned, the footnotes take care of the special cases. It’s still useful to have those on the list because:

  • There’s very few of them.
  • They can still be fixed by following the footnotes.
  • People may create duplicate requests otherwise.

Try the reinstalling fix, and if that doesn’t work, give specifics:

  • Alfred version.
  • macOS version.
  • Workflow version.
  • The command you’re running.

Link to comment
8 minutes ago, optimus1509 said:

Does this require python2 to be installed via homebrew?

 

Yes, that is the goal of the Workflows updated in the repo. Porting them to something else wouldn’t be so fast and wouldn’t allow for so many to be done. When they are officially updated, they are moved the bottom table, and some on the top table have listed alternatives.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...