Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 9 Online
OpenStudy (anonymous):

Hey Guys, i have a problem with the Hangman Game from the second problem set. When I run it without changing anything it gives me this error: inFile = open(WORDLIST_FILENAME, 'r', 0) ValueError: can't have unbuffered text I/O I am using Eclipse as development environment thanks!

OpenStudy (rsmith6559):

Try: inFile = open(WORDLIST_FILENAME, 'r') The ", 0" isn't needed and apparently in different OS's and/or Python versions can cause problems.

OpenStudy (anonymous):

Thanks for your help, I really appreciate it!! It worked, but now I get another error: wordlist = string.split(line) AttributeError: 'module' object has no attribute 'split' Could you help me again? Thanks a lot!

OpenStudy (rsmith6559):

strings are treated as objects of type string. The method split() should be called on an instance of a string. string is a Python module. The code should be something like: >>> foo = "Hello World" >>> foo.split( ' ' ) ['Hello', 'World'] >>> The split() method takes a string to use to split the parent string on ( in this case, space ).

OpenStudy (anonymous):

I am using Python 3.5 and work in LiClipse. Apparently, there were some changes specific either to OS or to Python version which require small changes in syntax. So in your case try wordlist = str.split(line). Should work.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!