Search code examples
python-3.xsleep-mode

Program crash on startup and restarts


my program runs fine, but sometimes on startup it stops? or crashes? and immediately reloads. I don't know why it's doing that. It's not erroring me. and it only started after I added the sleep function.

    import time
    print ( "loading cakes.. please wait")
    time.sleep(3)
    print ("cakes now loaded - enjoy your program")
    time.sleep(1)

    print ( "Enter a People Name" )
    name = (input())

    print ( "Enter Years of a People, I'll tell you the Years in Doggo : ", end = "")
    ppl = float(input())

    doggo = ppl * 7


    print (name, "Is a People, with a People Years of", ppl, )
    print (name,"'s Age in People Years is", ppl, " and is equal to", doggo, "Doggo Years " )
    time.sleep(2)
    print("(・・;) you're so old") 

picture of the thing

it's not vital I think, but an answer would be greatly appreciated.


Solution

  • I had this problem once, it was the anti-viruscanner that caused it. It paused the script to check it, and then restarted it once it cleared the scan.

    Edit, sry for stuffing the code in the comments. (My version is Python 2.7, but 3.x should be the same)

    #!c:\Python27\python.exe
    # -*- coding: utf-8 -*-
    import time
    print ( "loading cakes.. please wait")
    time.sleep(3)
    print ("cakes now loaded - enjoy your program")
    time.sleep(1)
    name = raw_input("Enter a People Name\n")
    ppl = float(raw_input("Enter Years of a People, I'll tell you the Years in Doggo : "))
    doggo = ppl * 7
    print ("%s Is a People, with a People Years of %d" %(name, ppl))
    print ("%s's Age in People Years is %d and is equal to %d Doggo Years " %(name, ppl, doggo))
    time.sleep(2)
    print("(・・;) you're so old")