try: fd = open(arg, 'r') except IOError, err: parser.error(err)