보통 Ctrl + C로 작업을 중단 할 수 있지만 때로는 스레드를 사용할 때 작동하지 않습니다. 아래 예를 참조하십시오.어떻게 파이썬에서 차단 방법을 중단시킬 수 있습니까?
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.sleep(100)
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
K eyboardInterrupt
>>> import Queue
>>> q = Queue.Queue(maxsize=3)
>>> q.put(0)
>>> q.put(1)
>>> q.put(2)
>>> q.put(3)
^C^C^C^C^C^C^C^C
^C^C^C
^C^C
^C
@*#()#@#@$!!!!!
편집 : 다시 통역을 얻을 수있는 방법이 있나요? 솔루션은 지금까지 당신은 \ Ctrl 키와 + 를 파이썬 인터프리터를 죽일 수
이것은 특히 스레딩 문제인 것으로 보입니다. Ctrl-C는'raw_input()'과 같이 인터럽트를 잘 처리합니다. –
주 스레드 만 신호를받습니다. – Keith