Skip to content

Not working on the latest MacOS 12.3 #182

Open
@wisinfun

Description

@wisinfun

First of all, thank you.
Not working on the latest MacOS 12.3

Activity

fedecalendino

fedecalendino commented on Mar 14, 2022

@fedecalendino

I think Apple finally removed python2.7 from macOS since the command python cannot be found by Alfred.

edit: Migrating the workflow library with 2to3 and using python3 in my Script Filters, did the trick to revive my workflows: https://github.com/fedecalendino/alfred-workflow/commit/650e193cda80e3fe16cb7fcbfa805e71371f6d93

Although they are quite simple, so it might not work for everyone as well.

psifertex

psifertex commented on Mar 15, 2022

@psifertex

It's especially ironic given the text:

Alfred-Workflow is targeted at the system Python on macOS. Its goal is to enable developers to build workflows that will “just work” for users on any vanilla installation of macOS since Snow Leopard.

Yeah, well, for some time it's been obviously that Python2 was going away. For it to "just work" now, it needs python 3 support.

at the bottom of https://www.deanishe.net/alfred-workflow/supported-versions.html#why-no-python-3-support

psifertex

psifertex commented on Mar 15, 2022

@psifertex

For anyone else in the same boat, might want to check out this fork: https://github.com/NorthIsUp/alfred-workflow-py3

(found via the pinned issue: #97)

moneygalaxy

moneygalaxy commented on Mar 16, 2022

@moneygalaxy

macOS has removed the python2.7. You need to follow the steps to solve your problem:

First, you need to reinstall Python 2. To do so, install Homebrew then run the following in a terminal:

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"

Now you can use "python filename.py" to run your python2 file in the macOS terminal.
You can also run your python2 code in the Alfred Script Filter.

But if you use bash to run your python2 file in Alfred, you need to do one more thing.
Change your bash command in your workflow configuration from:
python filename.py "{query}"
to:
${HOME}/.pyenv/versions/2.7.18/bin/python filename.py "{query}"
If you don't do this you will get an error report by Alfred debugger which is "/bin/bash: python: command not found"

xavdid

xavdid commented on Mar 17, 2022

@xavdid

Here's Apple's release notes on the subject. Namely:

Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead.

See also, this Stack Exchange thread

FischLu

FischLu commented on Mar 18, 2022

@FischLu

It's especially ironic given the text:

Alfred-Workflow is targeted at the system Python on macOS. Its goal is to enable developers to build workflows that will “just work” for users on any vanilla installation of macOS since Snow Leopard.

Yeah, well, for some time it's been obviously that Python2 was going away. For it to "just work" now, it needs python 3 support.

at the bottom of https://www.deanishe.net/alfred-workflow/supported-versions.html#why-no-python-3-support

I agree with you, the sentence you quoted is ridiculous. Even if the developers stick to their views, they should be prepared for python3 in another branch. "just work" can become "just not work" in one night, now, it happens and no official "just work" solutions.

raingao

raingao commented on Mar 18, 2022

@raingao

macOS has removed the python2.7. You need to follow the steps to solve your problem:

First, you need to reinstall Python 2. To do so, install Homebrew then run the following in a terminal:

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"

Now you can use "python filename.py" to run your python2 file in the macOS terminal. You can also run your python2 code in the Alfred Script Filter.

But if you use bash to run your python2 file in Alfred, you need to do one more thing. Change your bash command in your workflow configuration from: python filename.py "{query}" to: ${HOME}/.pyenv/versions/2.7.18/bin/python filename.py "{query}" If you don't do this you will get an error report by Alfred debugger which is "/bin/bash: python: command not found"

and you should replace '/usr/bin/python' -> '/usr/local/bin/python' in /workflow/background.py

fedecalendino

fedecalendino commented on Mar 18, 2022

@fedecalendino

I also don't get why we didn't have a version of the code that would work on both version of Python, plenty of libraries do that.

techouse

techouse commented on Mar 20, 2022

@techouse

I faced the same issue a few weeks ago and decided to bite the bullet and migrate all my workflows to Dart because it can be compiled into a standalone executable eliminating the need for any external prerequisites.

In the process, I had to build a library just like this one in Dart. The Alfred docs helped a lot. Was a lot of work but fun 😊

linked a pull request that will close this issue on Mar 23, 2022
devnoname120

devnoname120 commented on Mar 23, 2022

@devnoname120

See #183

5 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @psifertex@techouse@xavdid@devnoname120@fedecalendino

      Issue actions

        Not working on the latest MacOS 12.3 · Issue #182 · deanishe/alfred-workflow