Skip to content

Commit c5d39c7

Browse files
author
Romain Taprest
committed
[CLI] Replace FileNotFoundError by IOError for 2.7 compat
1 parent 6fe9171 commit c5d39c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jsonschema/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def parse_args(args):
184184
def make_validator(schema_path, validator_class, output_writer):
185185
try:
186186
schema_obj = _load_json_file(schema_path)
187-
except (ValueError, FileNotFoundError) as exc:
187+
except (ValueError, IOError) as exc:
188188
output_writer.write_parsing_error(schema_path, exc)
189189
raise exc
190190

@@ -210,7 +210,7 @@ def load_stdin(stdin, output_writer):
210210
def load_instance_file(instance_path, output_writer):
211211
try:
212212
instance_obj = _load_json_file(instance_path)
213-
except (ValueError, FileNotFoundError) as exc:
213+
except (ValueError, IOError) as exc:
214214
output_writer.write_parsing_error(instance_path, exc)
215215
raise exc
216216
return instance_obj
@@ -246,7 +246,7 @@ def run(arguments, stdout=sys.stdout, stderr=sys.stderr, stdin=sys.stdin):
246246
arguments["validator"],
247247
output_writer,
248248
)
249-
except (FileNotFoundError, ValueError, SchemaError):
249+
except (IOError, ValueError, SchemaError):
250250
return False
251251

252252
errored = False
@@ -259,7 +259,7 @@ def run(arguments, stdout=sys.stdout, stderr=sys.stderr, stdin=sys.stdin):
259259
validator,
260260
output_writer,
261261
)
262-
except (ValueError, FileNotFoundError, ValidationError):
262+
except (ValueError, IOError, ValidationError):
263263
errored = True
264264
elif (
265265
stdin is sys.stdin and not sys.stdin.isatty()

0 commit comments

Comments
 (0)