Vuo 2 beta / run Python script

Hi all!
I need to control Philips Hue Lamps from Vuo using phue python library, but have got an Error messages.
What I’m doing wrong:

I’m trying to run Python script from the “Exequte Shell Command” node.
Here’s the Error message I’ve got:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/tmp/**vuo-app-shell-noLgar**", line 3, in <module>
    b = Bridge('192.168.1.101')
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/phue.py", line 628, in __init__
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/phue.py", line 751, in connect
    self.register_app()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/phue.py", line 719, in register_app
    'The link button has not been pressed in the last 30 seconds.')
phue.PhueRegistrationException: (101, 'The link button has not been pressed in the last 30 seconds.')

When I run the same script from Terminal - scripts work.

I think that problem occurs because the script is running from the Vuo shell. (vuo-app-shell-noLgar)
Maybe not enough permissions?
PS: before. each try I pressed “The link button”.

Vuo composition attached.

phue_mouse_click.vuo (4.37 KB)

Looks like that library obtains an access token and stores it in a config file in the home folder. The Execute Shell Command node prevents accessing the home folder, to make it harder for nefarious scripts to mess with your private data.

You could try copying the config file to the /tmp folder (which Execute Shell Command does have access to), then specify that as the config file location. In Terminal:

cp ~/.python_hue /tmp/.python_hue

Then modify the script like this:

b = Bridge('192.168.1.101', None, '/tmp/.python_hue')
1 Like

Thanks a lot! Your solution works!

1 Like

.  

Applescript Test.vuo (1.11 KB)

How to put a value from a node output to the python script?

You could using “append text” to build the script. See the example attached, that changes the IP value each time the phue_on is called.

phue_mouse_click.vuo (5.43 KB)

3 Likes