vegardinho / alfred_bluetooth_controller

Alfred workflow for managing bluetooth settings and -connections
MIT License
95 stars 7 forks source link

Not working for me #11

Closed abosnjakovic closed 3 years ago

abosnjakovic commented 3 years ago

Hello I am trying to figure out why this is not working for me, debugging output is here. Will try to figure this one out but incase it is quicker to resolve by posting here. thanks.

Latest Alfred, latest version of this workflow installed. The blueutil cli works as expected.

[15:00:18.721] Logging Started... [15:00:24.359] Bluetooth Controller[Script Filter] Queuing argument '(null)' [15:00:24.502] Bluetooth Controller[Script Filter] Script with argv '(null)' finished [15:00:24.505] ERROR: Bluetooth Controller[Script Filter] Code 1: Traceback (most recent call last): File "./return_device_json.py", line 104, in <module> main() File "./return_device_json.py", line 30, in main js = check_output(cmd_args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 216, in check_output process = Popen(stdout=PIPE, *popenargs, **kwargs) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 394, in __init__ errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1047, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

If I tell this to use any other version of python I get

[15:19:10.683] Bluetooth Controller[Script Filter] Queuing argument '(null)' [15:19:10.853] Bluetooth Controller[Script Filter] Script with argv '(null)' finished [15:19:10.854] ERROR: Bluetooth Controller[Script Filter] Code 1: Traceback (most recent call last): File "/Users/adam/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9D05284E-C567-43C1-BDBB-C88D4BAEF336/./return_device_json.py", line 104, in <module> main() File "/Users/adam/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9D05284E-C567-43C1-BDBB-C88D4BAEF336/./return_device_json.py", line 20, in main subtitle = sys.argv[1].decode("utf-8") AttributeError: 'str' object has no attribute 'decode'

Debugging this in vscode image

abosnjakovic commented 3 years ago

Okay I found the problem, the hardcoded location of blueutil will not suffice for all users, we can find which blueutil first and build off that. I for one am using the m1 mac and have two bin locations for homebrew for example. I will submit a pr for this one.

vegardinho commented 3 years ago

Glad you sorted it out. Do submit a pull request!

abosnjakovic commented 3 years ago

12 this is what I came up with as finding the binary path was non trivial and shipping with binary simplified

this process.