Question

I am using the Python time.sleep() function in a GNURadio program. However, in spite of me having provided a floating point argument, the code runs into an unexpected Floating Point Exception. Please find the relevant code snippet below (please ignore the debugging "Hehe"'s :-)):

while not ack and timeout < 5: #FIXME: Hard-coded timeout interval
    print "Hehe5"   
    timeout+=1
    print "Hehe6"
    time.sleep(0.5)
    print "Hehe7"
    with lock:
        ack=recvd_prev_ack
    print "Hehe8"

This gives the following output:

Sent pktno=   0
Hehe
Hehe1
Hehe2
Hehe3
Hehe4
Hehe5
Hehe6
Floating point exception

So the point of error really is time.sleep(). Can someone please explain what could be going on here? My Python version is 2.7.1.

Thanks and Regards, Dhrubo

Was it helpful?

Solution

What's going on here is your program is threaded, and the Floating point exception is happening in another thread (not where you think).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top