hue-alfred-workflow icon indicating copy to clipboard operation
hue-alfred-workflow copied to clipboard

Support for macOS 12.3+

Open det-box opened this issue 2 years ago • 23 comments

Hello, since Monterey 12.3 it does not work anymore. There is no /usr/bin/python anymore, only /usr/bin/python3.

Please fix Thanks

det-box avatar Mar 16 '22 06:03 det-box

/usr/bin/php is also not available anymore

leonard84 avatar Mar 16 '22 08:03 leonard84

Yes /usr/bin/php and /usr/bin/python and /usr/bin/python2 do not exist anymore. Only /usr/bin/python3

[11:57:53.220] Logging Started... [11:57:58.518] Philips Hue Controller[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.166E76E4-66A5-477E-B97A-23FC8A6938BA%3E024CCF2C-F278-4295-B1AF-CCF8771F79AB)] Queuing argument '' [11:57:58.588] Philips Hue Controller[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.166E76E4-66A5-477E-B97A-23FC8A6938BA%3E024CCF2C-F278-4295-B1AF-CCF8771F79AB)] Script with argv '(null)' finished [11:57:58.590] ERROR: Philips Hue Controller[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.166E76E4-66A5-477E-B97A-23FC8A6938BA%3E024CCF2C-F278-4295-B1AF-CCF8771F79AB)] Code 127: /bin/bash: /usr/bin/python: No such file or directory

det-box avatar Mar 16 '22 10:03 det-box

There are dependency issues as well. Even if you try to replace /usr/bin/php and /usr/bin/python with a more correct location (php has to be installed manually or via homebrew), there are dependency errors for example:

Traceback (most recent call last): File "/Users/username/Dropbox/Apps/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AC154D62-5687-4CEF-A3EC-A59E2E3FABD3/logic/setup.py", line 8, in <module> from packages.workflow import Workflow3 as Workflow File "/Users/username/Dropbox/Apps/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AC154D62-5687-4CEF-A3EC-A59E2E3FABD3/logic/packages/workflow/__init__.py", line 16, in <module> from .workflow import Workflow, manager File "/Users/username/Dropbox/Apps/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AC154D62-5687-4CEF-A3EC-A59E2E3FABD3/logic/packages/workflow/workflow.py", line 25, in <module> import cPickle ModuleNotFoundError: No module named 'cPickle'

mattshelton avatar Mar 17 '22 14:03 mattshelton

Yes unfortunately it seems both Python 2 and PHP were removed in recent versions of macOS which is a bummer! When I find time I will try to fix this but it's difficult as I no longer own Philips Hue lights (I switched to Lifx). Pull requests are welcome.

In the mean time, if you're technically savvy enough, re-installing Python 2 and PHP on macOS should solve the issues. Not ideal obviously!

benknight avatar Mar 17 '22 23:03 benknight

@benknight What was the reason to mix python and php in the first place, what was python missing?

leonard84 avatar Mar 21 '22 13:03 leonard84

There is a PHP script for the color picker only. The rest is Python

benknight avatar Mar 21 '22 13:03 benknight

In the mean time, if you're technically savvy enough, re-installing Python 2 and PHP on macOS should solve the issues. Not ideal obviously!

Hi, and thanks for your workflow :)

Is there a specific PHP version required?

niam0r avatar Mar 24 '22 18:03 niam0r

@benknight can u precise how to install Python2 (using homebrew for example) and which version of PHP is required ? Thanks

BenoitFroment avatar Apr 05 '22 10:04 BenoitFroment

Run the following commands, download and import the modified version and you'll be good to go.

brew install pyenv
pyenv install 2.7.18
ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "/usr/local/bin/python"

Download the following and import. If the workflow asks you to update it, DON'T. It's because I've changed the internal files of the workflow.

I just replaced /usr/bin/python with /usr/local/bin/python in 2 different files.

Philips Hue Controller.alfredworkflow.zip

sarpdoruk avatar Apr 10 '22 16:04 sarpdoruk

I've tried this Sarpdoruk. The first two commands worked but when I tried the 3rd I get a message saying: ln: /usr/local/bin/python: Permission denied

When use Alfred and type "hue" also get the following error:

Code 127: /bin/bash: /usr/local/bin/python: No such file or directory

Any idea what's happening?

dscox avatar Apr 20 '22 23:04 dscox

I've tried this Sarpdoruk. The first two commands worked but when I tried the 3rd I get a message saying: ln: /usr/local/bin/python: Permission denied

When use Alfred and type "hue" also get the following error:

Code 127: /bin/bash: /usr/local/bin/python: No such file or directory

Any idea what's happening?

Try running this with "sudo" prefix like below. You will need to enter your password when prompted.

sudo ln -s "${HOME}/.pyenv/versions/sudo 2.7.18/bin/python2.7" "/usr/local/bin/python"

sarpdoruk avatar Apr 20 '22 23:04 sarpdoruk

Thanks Sarpdoruk, unfortunately I'm still getting the same Code 127 error. No idea what's happening. It worked fine before the Monterey upgrade, but not anymore. Should I install Python 2?

dscox avatar Apr 21 '22 01:04 dscox

Thanks Sarpdoruk, unfortunately I'm still getting the same Code 127 error. No idea what's happening. It worked fine before the Monterey upgrade, but not anymore. Should I install Python 2?

Yes, you do need Python2. Actually, that's what the first part of the command does. It installs Python2.7 so that the workflow can use it.

sarpdoruk avatar Apr 21 '22 07:04 sarpdoruk

Yeah still not working... and followed the three steps precisely:

brew install pyenv gave me this output Screen Shot 2022-04-21 at 17 21 11

pyenv install 2.7.18 just, well, reinstalled what was already there (and I got this response) Screen Shot 2022-04-21 at 17 25 42

ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "/usr/local/bin/python" gave me this output: Screen Shot 2022-04-21 at 17 26 21

And after downloading the attached .zip and installing the workflow, when I tried to run it with Alfred it looks like this: Screen Shot 2022-04-21 at 17 27 30

Any ideas what could be happening?

dscox avatar Apr 21 '22 07:04 dscox

Hey guys sorry I've been missing from this conversation. I've update the README with steps for getting the workflow to work again. In the mean time I'm waiting for a Python3-compatible version of this workflow's primary dependency to become available. Once that happens I'll publish a new release and close this issue.

benknight avatar May 07 '22 21:05 benknight

Since I no longer have a Philips Hue system in my possession I'm looking for a contributor to do the Python 3 upgrade. Github user xilopaint is working on a hard fork of the Alfred-Workflow library which aims to support all existing features on Python 3. He hasn't published it yet but the latest source can be pulled from one if his workflow projects. See this comment for more details: https://github.com/deanishe/alfred-workflow/issues/97#issuecomment-1120290043

benknight avatar May 08 '22 15:05 benknight

Morning/Evening all... just wanted to give you an update, as I appear to be the only person suffering issues with this. I've installed Python 2 and done everything per the README, but alas it's still not working for me. Also, I checked the scripts to make sure it says /opt/homebrew/bin/python. Now have the following error... is it just me?

[10:37:54.032] Philips Hue Controller[Script Filter] Queuing argument '' [10:37:54.115] Philips Hue Controller[Script Filter] Script with argv '(null)' finished [10:37:54.116] ERROR: Philips Hue Controller[Script Filter] Code 1: . 10:37:54 workflow.py:2061 DEBUG ---------- Philips Hue Controller (3.0.7) ---------- 10:37:54 workflow.py:1468 DEBUG reading settings from /Users/darren/Library/Application Support/Alfred/Workflow Data/hue-alfred-workflow/settings.json 10:37:54 workflow.py:1468 DEBUG reading settings from /Users/darren/Library/Application Support/Alfred/Workflow Data/hue-alfred-workflow/settings.json 10:37:54 workflow.py:2338 INFO checking for update ... 10:37:54 background.py:230 DEBUG [__workflow_update_check] command cached: /Users/darren/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/hue-alfred-workflow/__workflow_update_check.argcache 10:37:54 background.py:234 DEBUG [__workflow_update_check] passing job to background runner: [u'/usr/bin/python', 'logic/packages/workflow/background.pyc', u'__workflow_update_check'] 10:37:54 workflow.py:2080 ERROR [Errno 2] No such file or directory Traceback (most recent call last): File "logic/packages/workflow/workflow.py", line 2070, in run self.check_update() File "logic/packages/workflow/workflow.py", line 2340, in check_update run_in_background('__workflow_update_check', cmd) File "logic/packages/workflow/background.py", line 235, in run_in_background retcode = subprocess.call(cmd) File "/Users/darren/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 172, in call return Popen(*popenargs, **kwargs).wait() File "/Users/darren/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 394, in init errread, errwrite) File "/Users/darren/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 1047, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory 10:37:54 workflow.py:2103 DEBUG ---------- finished in 0.014s ---------- [10:37:54.118] Philips Hue Controller[Script Filter] { "items": [ { "valid": false, "subtitle": "[Errno 2] No such file or directory", "icon": { "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns" }, "title": "Error in workflow 'Philips Hue Controller'" } ] }

dscox avatar May 19 '22 00:05 dscox

Hey @dscox my bad, I forgot to update some references to the system-installed Python 2 that used to exist before macOS 12.3.

Please download and install v3.0.8 from the releases page here: https://github.com/benknight/hue-alfred-workflow/releases/tag/v3.0.8

Of course, make sure you've also already followed the instructions to install Python 2 via Homebrew (which I'm pretty sure you already did).

benknight avatar May 22 '22 17:05 benknight

It's ALLLLLIIIIIIIIVE!!!

I mean... thanks; it works! Great stuff. Thanks again Ben/all.

dscox avatar May 22 '22 22:05 dscox

hi all, for me homebrew installs to /usr/local/bin/, so after installing Python 2 per the Alfred instructions, I had to modify the Script Filter and the bash Run Script to use /usr/local/bin/python. Works great.

@benknight this is an awesome workflow! maybe we can all chip in and send you a Hue bridge and light!

subelsky avatar May 24 '22 19:05 subelsky

@subelsky ha, thanks! That's odd that it installs to a different location even when you're on the most recent version of macOS.

As for sending me a bridge, thanks for the offer! The reason I don't have a Hue system anymore is twofold - first I'm a nomad so I try to avoid carrying too much, and back in 2017 I switched to using LIFX instead because at the time it was a better system (wider color gamut, better app) but I'm not sure if that's still true.

benknight avatar May 24 '22 19:05 benknight

It's really funny you should say that Ben. I actually went out and bought a LIFX light, as the Hue workflow wasn't working. My intention was to use a LIFX workflow instead (with my new fancy COLOURED light!)... but the LIFX workflows I tried didn't work either. :-(

Soooooo.... don't suppose in your technological wisdom you've created something similar for LIFX have you? I can't seem to find an Alfred workflow that works, and the developer I've messaged isn't too concerned about getting it to function.

I know... I'm a cheeky bastard, but hey... what can I say? :-)

dscox avatar May 24 '22 22:05 dscox

Haha it's an idea I've explored many times. I would say at this particular point I'm not really interested in working on it, but who knows, maybe one day.

To me recollection, I believe the last time I looked LIFX had an API that only worked with an active internet connection (rather than directly with the lights via the local network) so it would be hard to reuse this code, but again there's a good chance that has changed since it's been many years since I explored the possibility.

benknight avatar May 24 '22 23:05 benknight