1

I'm trying to make the the second print statement wait until I press enter in the command line but I keep getting an unexpected EOF error.

print "hi"
continu = input("Press Enter to continue!")
print "hi"

Here is my traceback

Traceback (most recent call last):
  File "save_cookies.py", line 2, in <module>
    continu = input("Press Enter to continue!")
  File "<string>", line 0

    ^
SyntaxError: unexpected EOF while parsing
6
  • how are you running your script? I mean as python save_cookies.py? Commented Dec 8, 2015 at 10:02
  • 1
    Which python version are you using? It looks like you are mixing python2 and python3 statements Commented Dec 8, 2015 at 10:03
  • @AyushShanker I'm pressing F5 while in geany. Commented Dec 8, 2015 at 10:04
  • Yep, Which Python version are you using? Commented Dec 8, 2015 at 10:05
  • 3
    If you're using Python 2.x, then change input to raw_input. Commented Dec 8, 2015 at 10:06

2 Answers 2

1

It looks like your are mixing python2 and python3 statements.

For python2 you need to use raw_input (PEP 3111):

print "hi"
raw_input("Press Enter to continue!")
print "hi"

For python3 instead, you need to adjust the syntax on the print (PEP 3105):

print("hi")
input("Press Enter to continue!")
print("hi")
Sign up to request clarification or add additional context in comments.

Comments

1

Try using raw_input() instead of input().

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.