Skip to content

Commit

Permalink
Windows errors
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Dec 6, 2016
1 parent beb6ce1 commit 29ca339
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions fs/error_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class _ConvertOSErrors(object):
DIR_ERRORS[errno.ENOTDIR] = errors.DirectoryExpected
DIR_ERRORS[errno.EEXIST] = errors.DirectoryExists
DIR_ERRORS[errno.EINVAL] = errors.DirectoryExpected
DIR_ERRORS[267] = errors.DirectoryExpected

def __init__(self, opname, path, directory=False):
self._opname = opname
Expand Down
7 changes: 7 additions & 0 deletions fs/osfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ def _scandir(self, path, namespaces=None):
_path = abspath(normpath(path))
sys_path = self._to_sys_path(_path)
with convert_os_errors('scandir', path, directory=True):
try:
scan_iter = scandir(sys_path)
except OSError as error:
if error.errno == 267:
# Translate Windows 267 error
raise errors.DirectoryExpected(path)
raise
for dir_entry in scandir(sys_path):
info = {
"basic": {
Expand Down

0 comments on commit 29ca339

Please sign in to comment.