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

Im having an error in Problem set 2, with the help code, it doesnt run as it is supposed to. Only does the first print ('Loading word list from file...') and then it says can't have unbuffered text I/O. Can somenone help me ? Thanks

OpenStudy (anonymous):

which version of python are you using? which platform? win/idle, win/command prompt, mac, linux?? try changing this line ``` inFile = open(WORDLIST_FILENAME, 'r', 0) ``` to ``` inFile = open(WORDLIST_FILENAME, 'r') ``` if that works, it should print " 55900 words loaded"

OpenStudy (anonymous):

im using version 3.3.2, on idle win 7, i tihink it has something to do with the version of python

OpenStudy (anonymous):

i tried what you said and gave me the error: line 28, in load_words wordlist = string.split(line) AttributeError: 'module' object has no attribute 'split' >>>

OpenStudy (anonymous):

so the problem sets and lecture code are all based on version 2.5 but 2.7.x will work. There are enuff differences with version 3x that you will find little annoying problems. if you plan on sticking with 3.x for this course, be prepaired to figure a few things out. Get used to using the documentation (F1 from IDLE). ``` wordlist = string.split(line) ``` so what does that line of code do? what is an AttributeError? what is a module? what is the string module? what do you need to change to make that work with v3.x?

OpenStudy (anonymous):

Thanks a lot, i think i'll change for 2.7, it´s better, i already lost time figuring out stupid things, that were caused by changes in the version, again thank you

OpenStudy (anonymous):

those first four questions i asked in the previous post are worth figuring out regardless of the version you are using.

OpenStudy (e.mccormick):

To be honest 2.7 is better for learning computer science because in 2.7, 3/2=1. In 3.3.x 3/2=1.5000000000 some minor fraction error thanks to floating point. So 3.3.x is better for the user because it works more like people do. 2.7 works more like other languages and forces you to understand the issues of floating points and integers in computers.

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!