A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • one year ago

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!

  • This Question is Open
  1. rsmith6559
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 1

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

  2. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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!

  3. rsmith6559
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 1

    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 ).

  4. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.