types-grpcio-status
raw JSON → 1.0.0.20260408 verified Mon Apr 27 auth: no python
Typing stubs for grpcio-status, version 1.0.0.20260408. Provided by typeshed. Updated in lockstep with the grpcio-status package. This is a stub-only package that adds type annotations to grpcio-status. Released weekly or as needed.
pip install types-grpcio-status Common errors
error ModuleNotFoundError: No module named 'grpc_status' ↓
cause Missing grpcio-status package or import path mistake.
fix
Install grpcio-status: pip install grpcio-status
error ImportError: cannot import name 'rpc_status' from 'grpc_status' ↓
cause The module or attribute may not exist in the installed version of grpcio-status.
fix
Check your grpcio-status version and ensure it supports rpc_status. Upgrade to a newer version: pip install --upgrade grpcio-status
error TypeError: 'NoneType' object has no attribute 'code' ↓
cause rpc_status.from_call(e) returned None because the error is not a proper gRPC status.
fix
Check that the exception is a grpc.RpcError and handle None case: if status is not None: ...
Warnings
gotcha Do not import from grpcio_status directly. The correct top-level module is grpc_status. ↓
fix Use 'from grpc_status import rpc_status'.
deprecated The types-grpcio-status package is a stub-only package. Ensure you have the corresponding grpcio-status package installed, otherwise the stubs are useless. ↓
fix Install grpcio-status: pip install grpcio-status
gotcha The stub types may not perfectly match the runtime if the version of grpcio-status lags behind the stub version. Always keep both packages in sync. ↓
fix Pin both packages to compatible versions.
Imports
- grpc_status wrong
from grpcio_status import rpc_statuscorrectfrom grpc_status import rpc_status
Quickstart
import grpc
from grpc_status import rpc_status
from google.protobuf import any_pb2
try:
# your gRPC call
except grpc.RpcError as e:
status = rpc_status.from_call(e)
if status:
print(f"Error code: {status.code}, details: {status.details}")