Merge pull request #24124 from gnossen/windows_oserror

[gRPC Easy] Fix import errors on Windows
pull/24145/head
Richard Belleville 4 years ago committed by GitHub
commit f4d29f26c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      tools/distrib/python/grpcio_tools/grpc_tools/protoc.py

@ -146,12 +146,14 @@ if sys.version_info >= (3, 5, 0):
self._codegen_fn = codegen_fn
def find_spec(self, fullname, path, target=None):
if not fullname.endswith(self._suffix):
return None
filepath = _module_name_to_proto_file(self._suffix, fullname)
for search_path in sys.path:
try:
prospective_path = os.path.join(search_path, filepath)
os.stat(prospective_path)
except (FileNotFoundError, NotADirectoryError):
except (FileNotFoundError, NotADirectoryError, OSError):
continue
else:
return importlib.machinery.ModuleSpec(

Loading…
Cancel
Save