Dear Tutors,

Alright, I'm using linux (ubuntu) and I took all of your advice and I got
something that works and doesn't work at the same time. Here's the source
code for my two programs called Lock and Key:

*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")

In the linux terminal I ran this command(they were both in my home folder,
so no directories were needed):

python Key.py | python Lock.py

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",
so I know sys.stdout.write() works for what I want it to, but I don't want
the EOF error. Here's the output:

Traceback (most recent call last):
  File "Lock.py", line 7, in <module>
    raw_input()
EOFError: EOF when reading a line

Please help me get rid of it because I couldn't find a sys.stdout.close()
command or any other std command that would help.

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

Reply via email to