Skip to content

Commit

Permalink
Python 3.4 & 3.5 lack os.fspath() support
Browse files Browse the repository at this point in the history
  • Loading branch information
brettcannon committed Oct 27, 2017
1 parent 1294d40 commit 981b362
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions importlib_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def _get_package(package) -> types.ModuleType:


def _normalize_path(path) -> str:
parent, file_name = os.path.split(path)
str_path = str(path)
parent, file_name = os.path.split(str_path)
if parent:
raise ValueError("{!r} is not only a file name".format(path))
raise ValueError("{!r} must be only a file name".format(path))
else:
return file_name

Expand Down

0 comments on commit 981b362

Please sign in to comment.