aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/_cython/cygrpc.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/grpcio/grpc/_cython/cygrpc.pyx')
-rw-r--r--src/python/grpcio/grpc/_cython/cygrpc.pyx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx
index 297c8001c5..f30fb17239 100644
--- a/src/python/grpcio/grpc/_cython/cygrpc.pyx
+++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx
@@ -29,6 +29,9 @@
cimport cpython
+import pkg_resources
+import os.path
+
# TODO(atash): figure out why the coverage tool gets confused about the Cython
# coverage plugin when the following files don't have a '.pxi' suffix.
include "grpc/_cython/_cygrpc/call.pyx.pxi"
@@ -45,6 +48,10 @@ include "grpc/_cython/_cygrpc/server.pyx.pxi"
cdef class _ModuleState:
def __cinit__(self):
+ filename = pkg_resources.resource_filename(__name__, '_windows/grpc.def')
+ directory = os.path.dirname(filename)
+ if not pygrpc_load_core(directory):
+ raise ImportError('failed to load core gRPC library')
grpc_init()
def __dealloc__(self):