後,這是我的代碼:回溯累積只Keyboardinterrutps
import autopy
import time
import math
width, height = 400, 400
a, b = 200, 200
r = 150
def drawCicle():
for x in range(0, 3):
for angle in range(0, 360, 1):
x = r * math.sin(math.radians(angle)) + a
y = r * math.cos(math.radians(angle)) + b
autopy.mouse.move(int(x),int(y))
time.sleep(0.002)
def mouseMove():
counter = 0
while counter < 4:
drawCicle()
counter += 1
else:
print('Drawing ' + str(counter) + ' circles')
print('moving once more in 10 seconds...')
counter = 0
time.sleep(10)
mouseMove()
if __name__ == "__main__":
mouseMove()
奇怪的是,該代碼運行得很好。我打破我的環帶KeyboardInterrupt
後只得到回溯,從各個線圈跑這樣的溢出積累回溯:
Traceback (most recent call last):
File "test.py", line 27, in <module>
mouseMove()
File "test.py", line 24, in mouseMove
mouseMove()
File "test.py", line 24, in mouseMove
mouseMove()
File "test.py", line 24, in mouseMove
mouseMove()
File "test.py", line 23, in mouseMove
time.sleep(10)
KeyboardInterrupt
如果我手動破解密碼這是專門只發生,任何人都可以提供一些線索,以什麼我無視最佳做法?
只需在'flush = True'中使用'print'即可立即查看打印語句。 – 2ps