当前位置: 动力学知识库 > 问答 > 编程问答 >

python - PyScripter - cannot termiate Run with KeyboardInterrupt

问题描述:

I write alot of small apps where I use

try:

print "always does this until I Ctrl+C"

Except KeyboardInterrupt:

print "finish program"

I've just began to move away from using IDLE and booted up PyScripter. However CTRL+C no longer works. Is it possible to still send in a KeyboardInterrupt while using the built-in interpreter?

网友答案:

In PyScripter if you just want to terminate a running program you can always re-initialize the remote engine:

  • Application Run Menu > Python Engine > Reinitialize Python Engine or
  • Interpreter context menu > Python Engine > Reinitialize Python Engine or
  • Keyboard shortcut CTRL-F2

Source, Psyscripter Author

网友答案:

I keep answering my own questions, but I believe they are valid..

The PyScripter google group has one implementation where they import a progress bar and kill it, simulating an interrupt. however, this is not the same as a keyboard interrupt. Looks like i'm out of luck until a new implementation.

Having Said That, can anyone suggest another novel way to terminate programs at a user's discretion (without using threads :p)?

分享给朋友:
您可能感兴趣的文章:
随机阅读: