Skip to content

cannot use intercept_channel with with statement #28

@wtnb75

Description

@wtnb75

grpc channel is usually used with with statement like here -> https://github.com/grpc/grpc/blob/master/examples/python/helloworld/greeter_client_with_options.py#L31

but...

import opentracing
from grpc_opentracing import open_tracing_client_interceptor
from grpc_opentracing.grpcext import intercept_channel
from grpc import insecure_channel

ic = open_tracing_client_interceptor(opentracing.global_tracer())
with intercept_channel(insecure_channel("localhost:5000"), ic) as ch:
  pass  # blabla
Traceback (most recent call last):
  File "testwith.py", line 7, in <module>
    with intercept_channel(insecure_channel("localhost:5000"), ic) as ch:
AttributeError: __enter__

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions