xbar icon indicating copy to clipboard operation
xbar copied to clipboard

Xbar Python plugin asdf python not found

Open t18n opened this issue 3 years ago • 1 comments

I installed Xbar and github-review-requests but the plugin says "env: python: No such file or directory".

Since I installed python with asdf, the execution path is /Users/me/.asdf/shims/python. I tried to symlink it to usr/bin/python but it doesn't work since MacOS blocks it. I then symlink it to usr/local/bin/python, and changed the plugin header from

#!/usr/bin/env python
# -*- coding: utf-8 -*-

to

#!/usr/local/bin/env python
# -*- coding: utf-8 -*-

but it still doesn't work. Did I miss something?

On an extra node, running

python "/Users/me/Library/Application Support/xbar/plugins/001-github-review-requests.5m.py" 

on the terminal works.

xbar asdf python not found

t18n avatar Oct 12 '22 08:10 t18n

The simplest thing you can do is simply update your shebang to the full path of your python installation, i.e.:

#!/usr/local/bin/env /Users/me/.asdf/shims/python

However, I wanted this to work "portably" across my various computers, which had node (in my case) in different places. asdf-controlled on one, and brew-controlled on another. So, based partly on the advice given in #730 I investigated the env commandline args, and found that -S and -P can work together to "augment" the path for the purposes of the execution. Thus I ended up with:

!/usr/bin/env -S-P/Users/me/.asdf/shims:/usr/local/bin:/usr/bin:${PATH} node

That way asdf node will be found first, if it exists, then /usr/local/bin if it exists, and so on, and we even have whatever PATH xbar plugins get at the end, so we don't clobber that. This works for me.

alexrussell avatar Feb 26 '23 23:02 alexrussell