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 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

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