wolph / alfred-converter

Alfred unit converter is a smart calculator for Alfred with support for unit conversions to make it a bit comparable to the Google Calculator and Wolfram Alpha.
93 stars 15 forks source link

Python 2 removed in macOS 8.3 beta #37

Closed jdloft closed 2 years ago

jdloft commented 2 years ago

Workflow fails with

Reason: launch path not accessible

/usr/bin/python

On latest macOS beta the old python 2 binary has been removed.

wolph commented 2 years ago

Can I assume that Python 3 is available?

The codebase should be compatible so that would be a quick fix

jdloft commented 2 years ago

Yes, Apple's python3 is still available at /usr/bin/python3. I imagine this is just a matter of changing the shebangs?

jdloft commented 2 years ago

This may be Alfred's bug because it seems to hardcode the interpreter to /usr/bin/python in the script filter.

jrduncans commented 2 years ago

While Alfred provides instructions for workflows such as this that require Python 2, it seems to imply that workflows should update to Python 3: https://www.alfredapp.com/help/kb/python-2-monterey/

How that is to be done isn't clear, I assume using bash or external script to call python3 instead.

wolph commented 2 years ago

I've created a new version that should fix the issue. Can you try? https://github.com/WoLpH/alfred-converter/blob/master/unit_converter.alfredworkflow

jrduncans commented 2 years ago

Looks like maybe some hardcoded references to your machine in there? I get this error when I look at debugging mode:

[17:23:48.325] ERROR: Unit converter[Script Filter] Code 1: Traceback (most recent call last): File "converter/main.py", line 102, in with open('/Users/rick/workspace/alfred-converter/log.txt', 'a') as fh: FileNotFoundError: [Errno 2] No such file or directory: '/Users/rick/workspace/alfred-converter/log.txt'

If I comment out this part of main.py, then things seem to work though 👍 :

    with open('/Users/rick/workspace/alfred-converter/log.txt', 'a') as fh:
        import pprint
        pprint.pprint(os.environ, stream=fh)
        print(sys.argv, file=fh)
wolph commented 2 years ago

Sorry about that. I accidentally left in that debug code

I've uploaded a new version :)