Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
handling open failures
#1
do all open() failures always cause an exception in the open() call and never just return a None or something else that could cause an exception later on? i'm wanting to move some failure handling to with open() that could be awkward if it needs to also check for returned errors.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
The doc says
Output:
Open file and return a corresponding file object. If the file cannot be opened, an OSError is raised.
Why not believe it?
Reply
#3
(Jan-07-2020, 09:59 PM)Gribouillis Wrote: The doc says
Output:
Open file and return a corresponding file object. If the file cannot be opened, an OSError is raised.
Why not believe it?

because i didn't see that line.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020