giovannicoppola / alfred-convert

Convert between different units in Alfred
Other
56 stars 1 forks source link

Cannot import name 'six' from 'pkg_resources.extern' #6

Closed gollmj closed 6 months ago

gollmj commented 6 months ago

[21:17:55.775] Convert[Script Filter] Queuing argument '1 usd eur' [21:17:55.873] Convert[Script Filter] Script with argv '1 usd eur' finished [21:17:55.880] ERROR: Convert[Script Filter] Code 1: . http_proxy= https_proxy= Traceback (most recent call last): File "/Users/Michael/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.7F84144A-911B-4BE8-9858-72F8950410A9/convert.py", line 19, in from pint import UnitRegistry, UndefinedUnitError, DimensionalityError File "/Users/Michael/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.7F84144A-911B-4BE8-9858-72F8950410A9/pint/init.py", line 17, in import pkg_resources File "/Users/Michael/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.7F84144A-911B-4BE8-9858-72F8950410A9/pkg_resources/init.py", line 57, in from pkg_resources.extern import six ImportError: cannot import name 'six' from 'pkg_resources.extern' (/Users/Michael/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.7F84144A-911B-4BE8-9858-72F8950410A9/pkg_resources/extern/init.py)

giovannicoppola commented 6 months ago

@gollmj you probably have other pythons installed. can you try adding /usr/bin/ to the python3 call, as below?

image
gollmj commented 6 months ago

That works perfectly, thank you and sorry for not trying that first.

Canorus commented 6 months ago

sorry to bother with closed issue, above method did help solving the issue for now.

But what I don't understand is, I already added following export commands ahead and it worked just fine up until today, why all of sudden script stopped functioning?

export PYTHONPATH="$PWD/lib"
export PATH=/opt/homebrew/bin:/usr/local/bin:$PWD/lib/bin:$PATH

in my case, I fixed by appending /usr/local/bin in front of python3

giovannicoppola commented 6 months ago

@Canorus have you recently installed Workflows from the Gallery? Some automatically install a brew python that then takes the precedence, so you need to add usr/local/bin to force Alfred to use the system python. the export PATH command is actually no longer needed in Alfred 5.

Canorus commented 6 months ago

@giovannicoppola

have you recently installed Workflows from the Gallery?

No, I've used this workflow since pre v.4.0.1

the export PATH command is actually no longer needed in Alfred 5.

I think this probably is why.. I can't recall using this workflow since Alfred 5 upgrade. thanks for the help!