🐛 💄 better error handling. fix #70

This commit is contained in:
chfw 2019-07-17 21:06:24 +01:00
parent c21d36f4d1
commit e65e939c1b
2 changed files with 11 additions and 1 deletions

View File

@ -190,7 +190,12 @@ def load_data(
reader = READERS.get_a_plugin(file_type, library)
except NoSupportingPluginFound:
if file_name:
if not os.path.exists(file_name):
if os.path.exists(file_name):
if os.path.isfile(file_name):
raise
else:
raise IOError("%s is not a file" % file_name)
else:
raise IOError("%s does not exist" % file_name)
else:
raise

View File

@ -15,6 +15,11 @@ from zipfile import BadZipfile
PY2 = sys.version_info[0] == 2
@raises(IOError)
def test_directory_name_as_file():
get_data('/')
def test_force_file_type():
test_file = "force_file_type.txt"
data = get_data(