Hi all,

I tried running the following code.

#! /usr/local/bin/python
import threading
import time

print "Press any key to start timer!"
input()
threadBreak = False
def TimeProcess():
    while not threadBreak:
        print "How are you?"
        print (time.time() - startTime)
startTime = time.time()
threading.Thread(target = TimeProcess).start()
input()
threadBreak = True
input ()
quit()

The above code when run gives the following error:

[root@host4 myscripts]# ./firstpython
Press any key to start timer!

Traceback (most recent call last):
File "./firstpython", line 6, in <module>
input()
File "<string>", line 0

^
SyntaxError: unexpected EOF while parsing
[root@host4 myscripts]#

If I run the code by commenting out the first occurrence of input(),
then I get an infinite loop where the statements in print are printed and it can be stopped only by ctrl + z.
Please any one help me in fixing this problem.

regards,
Prashanth

File "./firstpython", line 6, in <module>
input()
File "<string>", line 0

You want to use raw_input() for the Python version you are using, or enter an integer.

This question has already been answered. Start a new discussion instead.