You just need to change import time
to from time import sleep
from time import sleep
from datetime import datetime, time
sleep(timeout - ((time.time() - start_time) % timeout))
Since there are 2 time
imports python imports the functionality from the last imported module and hence couldn't find sleep
method in the datetime.time
module.
By importing implicitly sleep
from time
it will overcome it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…