我在GNURadio程序中使用Python time.sleep()函数。但是,尽管我提供了一个浮点参数,但代码会运行到意外的浮点异常。请从下面的相关代码段(请忽略调试“和合”的:-)):Python time.sleep()运行到浮点异常
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"
这给出了以下的输出:
Sent pktno= 0
Hehe
Hehe1
Hehe2
Hehe3
Hehe4
Hehe5
Hehe6
Floating point exception
所以错误的点真的是时间。睡觉()。有人可以解释一下这里可能会发生什么吗?我的Python版本是2.7.1。
感谢和问候, Dhrubo
有趣......认为你可以从控制台发布实际错误。我希望它有更多的细节,这将是有用的 – inspectorG4dget
你的缩进是错误的。请修复它。 –