Python Stop current Python REPL command, but keep REPL session open?

  • Thread starter Thread starter Swamp Thing
  • Start date Start date
  • Tags Tags
    Python
AI Thread Summary
When a command in the Python REPL is stuck in a synchronous wait, such as when using websocket.recv() that is waiting for a message, the recommended method to terminate just that command is to use Control-C. This keyboard interrupt allows users to exit the blocking command and return to the REPL prompt without losing the entire session. This technique is commonly effective for handling situations where a command is unresponsive.
Swamp Thing
Insights Author
Messages
1,032
Reaction score
770
If you just typed in a command into the Python repl, and it is stuck in a synchronous "waiting-for-something-to-happen", how can we terminate just that command and return to the same repl session?

For example, say we typed websocket.recv() and the websocket is waiting for a message... how can we end that and get back to the repl prompt without losing the whole session?
 
Technology news on Phys.org
Try control-c it usually works as a keyboard interrupt.
 
  • Like
Likes PeterDonis and Swamp Thing
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Replies
2
Views
836
Replies
15
Views
2K
Replies
4
Views
4K
Replies
22
Views
5K
Replies
3
Views
3K
Back
Top