May-03-2017, 07:48 PM
The code below is an attempt to catch an error opening and parsing a JSON file. When an error occurs, it does not print the text in the except block. Can someone explain this?
Python 2.7 on raspberry Pi 3
on a Windows 10 system
using the Xming server so I can program with Geany on the Laptop
I couldn't copy and paste the error from the Xmin server so here is an image
https://www.dropbox.com/s/dc3wthzsx8d9p3...r.JPG?dl=0
Python 2.7 on raspberry Pi 3
on a Windows 10 system
using the Xming server so I can program with Geany on the Laptop
1 2 3 4 5 6 7 8 9 10 11 |
def read_schedule_file( self ): try : with open ( "schedule.json" ) as sched: self .schedule_file = json.load(sched) except IOError as e: print print ( "Something went WRONG" ) print print "I/O error({0}): {1}" . format (e.errno, e.strerror) print print ( "No Error" ) |
https://www.dropbox.com/s/dc3wthzsx8d9p3...r.JPG?dl=0