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

On ps2 hangman, I keep getting this error: IOError: [Errno 2] No such file or directory: 'words.txt' What am I doing wrong? Thanks!

OpenStudy (woodrow73):

sounds like the .txt document 'words.txt' doesn't exist in the path it's trying to reach it at.. though I'm not positive.

OpenStudy (woodrow73):

Ps2? what language

OpenStudy (rsmith6559):

Is words.txt in the same folder as your program? With that syntax, it needs to be.

OpenStudy (woodrow73):

ya, the .txt document should be in the right project folder- doesn't have to be in the right class folder- I think just the right project. Anyway, if you're using java, you can create a file from the project using the PrintWriter class, and you can see where that file ends up- where that file ends up is the same spot you should expect to read in words.txt from. Or you can put words.txt wherever you want, then specify the path location in the PrintWriter/FileWriter/File class's constructors in java- don't know about other languages.

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!