A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 5 years ago

The professor made a mistake in lecture 10: at the end of the lecture, he's introducing the use of exceptions, and illustrates it with the getGrades function. Here's his explaination: "And if I go ahead and run this -- now it's going to say woops, at me. What happened? I'm down here and try, I'm trying do get grades, which is a call to that function, which is not bound in my computer. That says it's in here. It's in this tri-block. It raised an exception, but it wasn't and I O error. So it passes it back, past this exception, up to this level, which gets to that exception."

  • This Question is Closed
  1. maitre_kaio
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Sorry I was limited by the size of questions :) Maybe I ujst didn't understand what he was trying to explain, but I think he's mistaken. So I think this is what really happened : 1. The program calls the getGrades function 2. Inside getGrades, fopen can't find the file named grades.txt, so fopen raises an IOError 3. Because fopen is in a try block, the except IOError blocked is interpreted. The IOError is replaced by a GetGradesError. This error bubbles up to the caller, the main program. 4. In the main program, GetGradesError is catched and the except block prints 'whoops'

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

    i think you got it and i think he misspoke. http://pastebin.com/BCHLQz9y

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


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