Clarifai / clarifai-python

Experience the power of Clarifai’s AI platform with the python SDK. 🌟 Star to support our work!
https://github.com/Clarifai/clarifai-python
Other
25 stars 4 forks source link

Bugs in client / example #3

Closed SimonSteinberger closed 9 years ago

SimonSteinberger commented 9 years ago

Hi guys,

there's a typo in your example:

"from py.client import ClarifaiApi" should probably be "from client import ClarifaiApi"

But it would certainly make sense to pack the API client files into an extra directory, so the import would be: from clarifai.client import ClarifaiApi

In any case: I do get the following error when trying out this simple example: client.ApiError: URLError(gaierror(11004, 'getaddrinfo failed'),)

That happens both for local and remote files. Any suggestions?

Here's the full trackback:

Traceback (most recent call last): File "D:\Web\Development\temp.py", line 6, in print clarifai_api.tag_image_urls('http://pixabay.com/static/uploads/photo/2012/09/08/21/51/balkan-anemone-56414_640.jpg') File "D:\web\django\python\lib\site-packages\client.py", line 215, in tag_image_urls return self._multi_imageurl_op(image_urls, ['tag'], model=model) File "D:\web\django\python\lib\site-packages\client.py", line 367, in _multi_imageurl_op self._check_batch_size(image_urls) File "D:\web\django\python\lib\site-packages\client.py", line 331, in _check_batch_size self.get_info() # sets the image size and other such info from server. File "D:\web\django\python\lib\site-packages\client.py", line 117, in get_info self._get_json_response, url, data) File "D:\web\django\python\lib\site-packages\client.py", line 413, in _get_raw_response headers = header_func() File "D:\web\django\python\lib\site-packages\client.py", line 400, in _get_json_headers headers = self._get_authorization_headers() File "D:\web\django\python\lib\site-packages\client.py", line 393, in _get_authorization_headers access_token = self.get_access_token() File "D:\web\django\python\lib\site-packages\client.py", line 103, in get_access_token raise ApiError(e) client.ApiError: URLError(gaierror(11004, 'getaddrinfo failed'),)

zeiler commented 9 years ago

Hello, sorry to hear, we can't seem to replicate your issue on this end. Which OS are you using? Can you include the exact sequence of commands executed. Doing the import, constructing the object, and calling tag_image_urls seems to work for me. Did you pass in your client_id and client_secret from the developer website? You should get an UNAUTHORIZED error if not, but perhaps it's related.

SimonSteinberger commented 9 years ago

Client ID and secret were both set. I'm working on Windows 7 and possibly that's the cause. It wasn't any import error. Unfortunately, I didn't keep the test snippet and right now I don't have the time to look into it again ... I'll post right away if I try (and fail ;-)) again.