I have a problem that I hope you guys can help me out with. Im making a home automation system with RPi + Piface to control devices on the network.
#----------------------------------------------------------------------------------------
# LIGHTS Automation
#----------------------------------------------------------------------------------------
room=0
listen_for /Turn on kitchen lights/i do
lights('kitchen')
request_completed
end
def lights(varible)
IO.popen("python /root/SiriProxy/plugins/siriproxy-teamsiri/TeamsiriPython/test.py varible")
end
this is my line of code. Im calling a python script and it works fine but I want use functions "varible"will be the varible to pass to the script but it does not send it as a varible but a string. Any one got some good ideas how to solve it
Change
IO.popen("python /root/SiriProxy/plugins/siriproxy-teamsiri/TeamsiriPython/test.py varible")
to
IO.popen("python /root/SiriProxy/plugins/siriproxy-teamsiri/TeamsiriPython/test.py #{variable}")
and the variable value will be substituted into the string.
Note that this only works inside double-quoted strings.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.