10000 AttributeError: 'NoneType' object has no attribute 'from_call' · Issue #659 · googleapis/python-api-core · GitHub
[go: up one dir, main page]

Skip to content
AttributeError: 'NoneType' object has no attribute 'from_call' #659
Closed
@parthea

Description

@parthea

In exceptions.py, if grpcio-status is not installed, rpc_status is set to None

try:
import grpc
try:
from grpc_status import rpc_status
except ImportError: # pragma: NO COVER
warnings.warn(
"Please install grpcio-status to obtain helpful grpc error messages.",
ImportWarning,
)
rpc_status = None
except ImportError: # pragma: NO COVER
grpc = None

In _parse_grpc_error_details, when rpc_status is None, this leads to AttributeError: 'NoneType' object has no attribute 'from_call'

def _parse_grpc_error_details(rpc_exc):
try:
status = rpc_status.from_call(rpc_exc)
except NotImplementedError: # workaround
return [], None

We should add a check to make sure rpc_status is not None before calling rpc_status.from_call(rpc_exc)

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0