Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Loop stopping in cmd until Enter is pressed

I apologize in advance as this is going to be a vague question. I just hope someone has the same experience and can help me. Imagine a simple script that has this simple code in it:

for i in range(100):
    print(i)

When I run the script from the terminal (CMD), occasionally, the loop gets stuck but as soon as I press the Enter key in the terminal, it jumps back into working and the loop continues. I want to emphasize that there is nothing like a user input line in the code causing a pause in the loop until a key is pressed or anything like that in the code. Also, this never happens if I run the code inside an IDE. This only happens in CMD and in possibly in any script that has a loop like this.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

When you click on the command prompt it goes into select mode, you will see a white square. You will also see at the top of the command prompt it will say select. This will pause anything running in the cmd.

Select Mode

If you press enter that will get it out of select mode and will continue running the program

Non select mode

I believe this is what your running into.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading