For 6.00SC pset2, the code in ps2_hangman.py displays an error when run on Python 3.x (even after fixing print statement errors); can anyone shine a little light on why there is an error? Thank you.
I am not doing that module. Can you be a bit more specific about the error?
Traceback (most recent call last): File "/Users/jlee7x2/Documents/Python/6.00SC/psets/pset2/ps2/ps2_hangman.py", line 46, in <module> wordlist = load_words() File "/Users/jlee7x2/Documents/Python/6.00SC/psets/pset2/ps2/ps2_hangman.py", line 24, in load_words inFile = open(WORDLIST_FILENAME, 'r', 0) ValueError: can't have unbuffered text I/O
Take note that for that SC course, it was said in the course page you have to use Python 2.5.4 (2.6 and 2.7 also work) since most of the codes in the problem sets + sample answers are not compatible with Python 3. If you want to complete the SC course, I suggest you install an older version of Python :)
Try putting it in byte mode by changing the 'r' to 'rb' instead. That should do it.
Join our real-time social learning platform and learn together with your friends!