Handling I/O Errors : File IO Exception : File PYTHON examples


PYTHON examples » File » File IO Exception »

 

Handling I/O Errors



# shows how to safely open and read from a file and gracefully handle errors.

try:                                          
   fsock = open(filename, "rb"0)             
   try
       fsock.seek(-1282)                     
       tagdata = fsock.read(128)               
   finally:                                    
       fsock.close() 
except IOError:                                
    pass 


           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo File
» File IO Exception