This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Python shell keeps restarting
Type: behavior Stage: resolved
Components: IDLE, Windows Versions: Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Cross!Alex21, j-rewerts, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2018-07-28 10:59 by Cross!Alex21, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (8)
msg322542 - (view) Author: Aleksa Bulatovic (Cross!Alex21) Date: 2018-07-28 10:59
I was writing a code for my test in idle python.When i run the module it's just keeps restarting.
This is my code:

sins = 0
check = input()
if check == "check_sins":
second = input("Ok,you can start when you are ready,type Im Ready! if you want to start the game")
print("Welcome to How smart are you test")
name = input("What's your name? ")
if name == "Dimitrije":
    print("Nice to meet you Dimitrije")
start = input("Ready to start the test: ")
if start == "Yes":
    print("A) Gorillaz")
    print("B) Alvin and the chipmunks")
    print("C) Despacito 2")
    print("D) Who are you even")
    q1 = input("Which was the first animated band ever created? ")
    a1 = "A) Gorillaz"
    b1 = "B) Alvin and the chipmunks"
    c1 = "C) Despacito 2"
    d1 = "D) Who are you even"
    if q1 == "A" or q1 == "a":
        print("You are right,adding 10 sins for that")
        sins += 10
            sins = sins - 10
    print("A) Milan")
    print("B) ")
    if start == "Im ready!":
        print("Ok,let's start")
    if q1 == "A":
        print("You are right,adding 10 sins for that")
        sins = sins + 10
Note:I started learning python yesterday and sins are just a refrence of the youtube channel name called CinemaSins.So don't judge.
msg322606 - (view) Author: Jared (j-rewerts) * Date: 2018-07-29 03:26
First off, no judgment! :)

I just want to get some more details from you. 
1) How are you running your program?
2) How far into your program do you get?
3) What are you passing in as values for your Input() calls?
msg322614 - (view) Author: Aleksa Bulatovic (Cross!Alex21) Date: 2018-07-29 08:32
Im running as a idle python(when im in editor,i run the module)
I get like in 3 days(if you asked when did i get into the program,english is not my first language)
For my input calls i put a string so that player knows what to answer to.
I hope i answered your questions for details.(I don't understand some things when someone says like '	PyArg_ParseTupleAndKeywords' or something like that,im 12 year old so i don't understand some issues)
msg322630 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2018-07-29 11:23
Maybe you could describe what it looks like when it restarts? Or take a screenshot and share it so we can see what is happening?
msg322649 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-07-30 04:15
In IDLE, Run Module, F5, is a shortcut, in a sense, for saving the file to filename, switching to a terminal or console window, such as Command Prompt on Windows, and entering 'python -i filename'.  The -i means 'switch it interactive mode after running the file'.  When you are done, and close the window, you can switch back to the editor.

The IDLE Shell more-or-less simulates Python's interactive mode.  When you hit F5, a separator line is added, like 
=================== RESTART: F:\Python\a\ =====================
to indicate that Shell reinitialized itself and is now running your program.  This is completely normal and intended.  When your program finishes, Shell will display '>>> '.

Please try to read the IDLE doc, which is available on the Help menu as 'IDLE Help'.  You can ask about using Python and IDLE on python-list.   Always mention the Python version and operating system you are using.

You program has a bug.  In the 'else' section, it tries to print q1 without q1 being defined.

If a program has a severe bug that caused the Python executing your code to crash, Shell will restart with a line that does not have a filename, like
======================== RESTART ========================
This is hard to bring about and is also not an IDLE bug.
msg322661 - (view) Author: Aleksa Bulatovic (Cross!Alex21) Date: 2018-07-30 09:15
Well the error looks like this

===== RESTART: F:\Python Shell Learning\Games\How smart are you =====
i think it's normal but it won't show '>>> '.I will see what i can do,but thanks for some help.
msg322680 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-07-30 17:22
Again, that RESTART line is NOT an error.  IDLE's prompt is not displayed until your program is completely done.  It initially pauses on the second line 'check = input()', waiting for user input.

Start with a one-line file:

print('Hello to my game')

Run that and you will see the prompt.
msg322690 - (view) Author: Aleksa Bulatovic (Cross!Alex21) Date: 2018-07-30 20:25
Thanks Terry J. ReedyTerry.
Date User Action Args
2022-04-11 14:59:03adminsetgithub: 78439
2018-07-30 20:25:48Cross!Alex21setmessages: + msg322690
2018-07-30 17:22:15terry.reedysetmessages: + msg322680
2018-07-30 09:15:50Cross!Alex21setmessages: + msg322661
2018-07-30 04:15:06terry.reedysetstatus: open -> closed
type: behavior
messages: + msg322649

resolution: not a bug
stage: resolved
2018-07-29 11:23:01steve.dowersetnosy: + terry.reedy
messages: + msg322630

assignee: terry.reedy
components: + IDLE
2018-07-29 08:32:19Cross!Alex21setmessages: + msg322614
2018-07-29 03:26:08j-rewertssetnosy: + j-rewerts
messages: + msg322606
2018-07-28 10:59:29Cross!Alex21create