0

This is the code I'm trying to run in Sublime Text 3 for Windows 64-bit:

import time

print ("First to 21 is the winner,")
i=0
while i<21:
    print("you may say",i+1,"or",i+2)
    j=int(input("You say "))
    if j<i+1 or j>i+2:
        print ("You cheated,",)
    else:
        print ("I must say",j+1,"or",j+2,"hmmm...")
        time.sleep(2)
        i=i+3          
        print ("I say",i,)
print ("and I am the winner!")
print ("Had you won, the prize was a golden ruby laser!!")

This is the error message I get:

You say Traceback (most recent call last):
  File "C:\Users\Arvid\Documents\Grupdat\Lab3\test.py", line 7, in <module>
    j=int(input("You say "))
EOFError: EOF when reading a line

Is there an explanation to this problem and how can I avoid it?

Lozansky
  • 374
  • 1
  • 5
  • 13
  • "Run in Sublime Text"...? How exactly are you running that? – deceze Nov 12 '15 at 14:10
  • When does this code crash? When running or when trying to run the program. Works fine here when running it in Python 2.7 shell – Ørjan Nov 12 '15 at 14:15
  • @bærten When trying to run the program. It works in IDLE for me but not when I try to run it through Sublime. – Lozansky Nov 12 '15 at 14:23
  • Install sublimeREPL and then choose Tools->sublimerepl->python. See the two following posts: http://stackoverflow.com/questions/9142290/python-3-1-and-sublime-text-2-error and http://stackoverflow.com/questions/27690657/running-code-in-sublime-text-2-mac-os-x – Ørjan Nov 12 '15 at 14:26
  • @bærten I have sublimeREPL but how do I run the program through the Python tab in Sublime? – Lozansky Nov 12 '15 at 14:42

0 Answers0