"Exception m" to "Exception e" for conformity
Added error handling for missing APG program

I would use FileNotFoundError exception but python <3.3 doesn't have that so I use IOError instead