function sleep problem

Python and python framework
Post Reply
jia175891641
Posts: 10
Joined: Tuesday 12 June 2018 17:07
Target OS: Raspberry Pi
Domoticz version: V3.9000
Location: China-Zhejiang
Contact:

function sleep problem

Post by jia175891641 » Tuesday 24 July 2018 5:49

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: 10
Joined: Tuesday 12 June 2018 17:07
Target OS: Raspberry Pi
Domoticz version: V3.9000
Location: China-Zhejiang
Contact:

Re: function sleep problem

Post by jia175891641 » Wednesday 25 July 2018 4:52

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: No registered users and 3 guests