Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stub is not defined #145

Open
rperdon opened this issue Jul 17, 2023 · 1 comment
Open

Stub is not defined #145

rperdon opened this issue Jul 17, 2023 · 1 comment

Comments

@rperdon
Copy link

rperdon commented Jul 17, 2023

Running the sample code and it gets to line 21 and indicates stub is not defined. Clarifai application is a standalone on premise solution. It is not the most recent version of the web application.

Traceback (most recent call last):
File "clarifai.py", line 21, in
response = stub.PostModelOutputs(request, metadata=metadata)
NameError: name 'stub' is not defined

Windows 10
Python 3.7
Setuptools40.7.1

Using cached clarifai_grpc-9.1.1-py3-none-any.whl (198 kB)
Requirement already satisfied: grpcio>=1.44.0 in c:\python\python37\lib\site-packages (from clarifai-grpc) (1.51.0)
Requirement already satisfied: protobuf>=3.12 in c:\python\python37\lib\site-packages (from clarifai-grpc) (3.20.3)
Requirement already satisfied: googleapis-common-protos>=1.53.0 in c:\python\python37\lib\site-packages (from clarifai-grpc) (1.57.0)
Requirement already satisfied: requests>=2.25.1 in c:\python\python37\lib\site-packages (from clarifai-grpc) (2.28.1)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\python\python37\lib\site-packages (from requests>=2.25.1->clarifai-grpc) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in c:\users\adminrp\appdata\roaming\python\python37\site-packages (from requests>=2.25.1->clarifai-grpc) (2.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\adminrp\appdata\roaming\python\python37\site-packages (from requests>=2.25.1->clarifai-grpc) (1.25.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\adminrp\appdata\roaming\python\python37\site-packages (from requests>=2.25.1->clarifai-grpc) (2019.3.9)
Installing collected packages: clarifai-grpc
Successfully installed clarifai-grpc-9.1.1

@excaliburne
Copy link

Hey,

What code are you trying to run? Could you past the snippet here?

It simply looks like you haven't defined "stub" in a variable as outlined in the docs, e.g:

from clarifai_grpc.channel.clarifai_channel import ClarifaiChannel
from clarifai_grpc.grpc.api import resources_pb2, service_pb2, service_pb2_grpc
from clarifai_grpc.grpc.api.status import status_code_pb2

channel = ClarifaiChannel.get_grpc_channel()
stub = service_pb2_grpc.V2Stub(channel)

metadata = (('authorization', 'Key ' + PAT),)

userDataObject = resources_pb2.UserAppIDSet(user_id=USER_ID, app_id=APP_ID)

post_inputs_response = stub.PostInputs(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants