"Jacob Bender" <benderjaco...@gmail.com> wrote

*Lock.py: *

password = "a"
psswd_try = raw_input("What's the password? ")

if psswd_try == password:
   print "correct!!!"
   raw_input()
else:
   print "wrong"
   raw_input()
*
Key.py*:

import sys
sys.stdout.write("a")

And all went well except for an EOF error caused by the raw_input inside the "if" statement in my Lock program. However I did get it to print "correct",

You ask for two inputs but only provide one, so you get an error. The Key.py program closes stdout (which is Lock.py's stdin) before Lock.py gets any second input.
Add another print(or sys.stdout.write() ) to Key.py
and see how you get on.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to