Acidham / alfred-airpod-connector

Alfred Workflow to connect/disconnect AirPods (Airpod1/2, Airpod Pro) and Powerbeats Pro
35 stars 7 forks source link

debug console shows /bin/sh: blueutil: command not found #12

Closed rick-yao closed 1 year ago

rick-yao commented 1 year ago

I have installed blueutil ❯ blueutil Power: 1 Discoverable: 0

and my default shell is zsh. But seems the workflow cannot detect blueutil debug console output : [16:57:29.023] AirPods Connector[Script Filter] Queuing argument '(null)' [16:57:29.159] AirPods Connector[Script Filter] Script with argv '(null)' finished [16:57:29.163] STDERR: AirPods Connector[Script Filter] /bin/sh: blueutil: command not found [16:57:29.163] AirPods Connector[Script Filter] {

Acidham commented 1 year ago

Seems blueutil is not in path. Can you please open the workflow > /bin/zsh step and add the following line at the beginning:

source ~/.zshrc

the script should then look like:

source ~/.zshrc
./py3.sh con_manager.py "$1"
rick-yao commented 1 year ago

thanks for your quick reply but the solution you provided did not work. I also tried 'zsh ./py3.sh con_manager.py "$1"' but still didn't work. I installed blueutil via brew , is it somehow relevant to this ?

Acidham commented 1 year ago

The issue is that the shell is not loaded, and it seems the path to blueutil is not loaded. Can you exec where blueutil on terminal?

rick-yao commented 1 year ago

Yes , please check below output. ~ ❯ where blueutil /opt/homebrew/bin/blueutil /opt/homebrew/bin/blueutil

~ ❯ which blueutil /opt/homebrew/bin/blueutil

~ ❯

Acidham commented 1 year ago

ok can you please download update WF: https://github.com/Acidham/alfred-airpod-connector/blob/master/AirPods%20Connector.alfredworkflow

please tell me if it now works

rick-yao commented 1 year ago

I tried the updated version. It still didn't work. But there is one difference. please check the img below.

image
Acidham commented 1 year ago

can you please try to re-install blueutil

rick-yao commented 1 year ago

yes , I uninstalled and re-installed it just now but didn't resolve the issue. I checked that bash can also detects blueutil.

image
rick-yao commented 1 year ago

My python3 version ❯ python3 --version Python 3.10.9

not sure if this affects

Acidham commented 1 year ago

as mentioned before the path cannot be found.

what macOS are you using ?

normally should be on zsh not bash

Acidham commented 1 year ago

you can add into last WF step the following

PATH=/opt/homebrew/bin

then it works

rick-yao commented 1 year ago

I am using zsh , I just tried bash. Did you mean to add Path like the following ?

image
Acidham commented 1 year ago

yes exactly but please use this line, forgot to add $PATH: PATH=$PATH:/opt/homebrew/bin

Acidham commented 1 year ago

Bu there is something wrong with your set up. Usually /opt/homebrew/bin is part of a standard shell.

Can you please help to investigate?

  1. What is being returned when you exec echo $SHELL
  2. What is being returned when you exec cat ~/.zprofile
rick-yao commented 1 year ago

ahhh...still don't work after adding Path line. below is the output as per your request. ❯ echo $SHELL /bin/zsh

~ ❯ cat ~/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"

Added by Toolbox App

export PATH="$PATH:/Users/rick/Library/Application Support/JetBrains/Toolbox/scripts"

~ ❯

Acidham commented 1 year ago

Can you add export to the PATH in the workflow step as well, forgot to add it in my previous post: export PATH=$PATH:/opt/homebrew/bin

.zproflie looks good. eval "$(/opt/homebrew/bin/brew shellenv)" adds the /opt/homebrew/bin path to the PATH variable. Not sure why this not working for you.

rick-yao commented 1 year ago

Thanks , final solution should be " export PATH=$PATH:/opt/homebrew/bin ./py3.sh con_manager.py "$1" " source command is not needed. Thanks for your patience !

Acidham commented 1 year ago

But anyhow, something is wrong with your setup because it should be loaded in shellenv properly.

I will leave the export and release it. Should not hurt others.