Closed haakonstorm closed 8 months ago
From what I can figure out, this is an issue of python3 versions. There's .pyc files shipped with this workflow for python 3.9, 3.10 and 3.11. My system has brew installed python 3.12.2.
When the workflow runs, there are init functions under pkg_resources/extern
that try to import libraries packaging, six, pyparsing and appdirs. When those aren't found in the pycache, it looks in pkg_resources/extern
for those .py files there but they aren't there and hence fails.
There is also this in the workflow itself:
export PYTHONPATH="$PWD/lib"
export PATH=/opt/homebrew/bin:/usr/local/bin:$PWD/lib/bin:$PATH
This doesn't make sense to me. $PWD resolves to the workflow path itself upon workflow run, and the subfolder lib doesnt even exist there.
The logic to include /opt/homebrew/bin:/usr/local/bin
first in path, I don't understand why.
Also lib/bin doesn't exist.
I'm not sure how to proceed from here.
I've tried moving the .py files it complains about, from the _vendor
folder where they do exist, but then it complains up the chain when I debug from within Alfred.
both lines are irrelevant now, as 1) the libraries are no longer in a lib
folder, and 2) newer Alfred versions (>5 I think) have already the brew python in the path. The pyc
files are irrelevant as well.
What do you get with which -a python3
?
Aha, that is nice to know. I'm running latest Alfred.
which -a python3
:
/opt/homebrew/bin/python3
/usr/bin/python3
So the workflow is running my homebrew python, I added
python3 --version >&2
to the workflow shellcode:
Explicitly running /usr/bin/python3
resolves the problem and workflow works. That is python v3.9.6.
/usr/bin/python3 convert.py "$1"
yes, this is what I was going to suggest! sometimes multiple 🐍 can entangle you! Also, unless you use Convert primarily for currency exchanges, you might want to check the new Unit Converter from the Alfred team, it's fast and a bit more flexible.
Thanks for this! I'm sticking with this because it has both crypto, fiat and units in one package :) Greetings from rainy Oslo, Norway to wherever you are buddy! 🙏
(I'm closing this issue as workaround worked on my setup. Still, perhaps the issue should be investigated and a generalized solution should be found?)
conv
has worked flawlessly for a long time, now I can't find out why it throws this:Any tips for debugging this? Latest alfred, homebrew, everything updated. API key the same. Installed conv via Alfred gallery.
Is this an issue of python2 vs python3?