On Fri, Jul 05, 2013 at 09:59:44AM -0500, Jamie Strandboge wrote:
> >> + if opt.manifest:
> >> + try:
> >> + # should hide this in a common function
> >> + if sys.version_info[0] >= 3:
> >> + f = open(opt.manifest, "r", encoding="utf-8")
> >> + else:
> >> + f = open(opt.manifest, "r")
> >> + manifest = f.read()
> >> + except OSError:
> >> + error("Manifest file '%s' does not exist\n" % opt.manifest)
> >
> > I think the exception's reason should be printed, too -- "does not
> > exist" could be wrong if the file or directory permissions forbid
> > reading the file or if there are IO errors.
> >
>
> ACK. Updated to use:
> error("Could not read '%s'\n" % opt.manifest)Definitely better, it doesn't give any wrong hints :) but I should have said that I'd like it to print out the errno or strerror: http://docs.python.org/2/library/exceptions.html#exceptions.EnvironmentError There's a chance to give to the user the exact reason why something failed, that'd be ideal. Thanks
signature.asc
Description: Digital signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
