hello...i guess i missed my way somehow and had this posted somewhere else...
"""
thanks for the help nova
i have actually gone thru the docs but i dont seem to understand how to use signals or threading...is there any online doc that u can link me to?...also,i finally came across the sleep() function and it seems to work just fine...
using someething like t=Timer(20,serialOpen()) did not seem to be a wayout for me.
Along the way i got stuck trying to make a function loop forever but cary out certain actions at intervals of time.this is what i've come up with so far:
CODE
def istime2send():
while sendtime()>time():
sleep(sendtime()-time())
print 'sleeping'
while sendtime()==time():
sendtime(0.0011)
print '...'
def sendtime(interval=1):
act_time=3600*interval
sendtime=time()+act_time
return sendtime
help will be highly appreciated
.....attatched is my lil prog so far...
well i got over it somehow by doing this...
CODE
def istime2send(interval=1):
act_time=3600*interval
sendtime=time()+act_time
while sendtime>time():
sleep(act_time),
sendtime+=act_time
return True
it works like a spell!! but...
i still need some more help with selecting numbers,noting that i have to specify the time interval for each and have some way to send it...
i've come up with this so far...
CODE
def send2num():
numz={'08021111111':0.001,'08024434343':0.023,'08776663332':0.1}
for k,v in numz.iteritems():
if istime2send(v):
return k #print k
problem is if i use print k,it works properly but if i use return k---which is what i intend to do,it just keeps iteratiing over the first dict item...i.e
CODE
if __name__=='__main__':
while send2num():#or while True
print send2num()
help will be highly appreciated.