function sleep problem

Python and python framework

Moderator: leecollings

Post Reply
jia175891641
Posts: 5
Joined: Tuesday 12 June 2018 17:07
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9000
Location: China-Zhejiang
Contact:

function sleep problem

Post by jia175891641 »

Hi All , I feeled The problem of asynchronous sending is annoying :x
i means python's data send api send data must wait subfunction run over
like this:
...
def test():
sleep(1)
res=funx()
xxx.send("this is test"+res)
sleep(1)
res=funy()
xxx.send("this is test2"+res)

run result (this is not my hope):
sleep 2 second then xxx.send("this is test"+res) and xxx.send("this is test2"+res) almost at the same time :x :x


at windos i tryed import ulrlib.request lib and Solveed this problem
but PRi not supprt this lib (dnpwwo told me) . unfortunately my products run at PRi .
is any good way to Solve this problem?
user code in onconnect function i think is Not beautiful and not good to use
subprocess lib is the only way ? :?:
只要够努力 时间总会给你想要的
jia175891641
Posts: 5
Joined: Tuesday 12 June 2018 17:07
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9000
Location: China-Zhejiang
Contact:

Re: function sleep problem

Post by jia175891641 »

use subprocess.call() Is it the right way to solve the problem?
Look forward to your answer
只要够努力 时间总会给你想要的
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest