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

Django error when reading json response #39

Closed
eironman opened this issue Nov 24, 2016 · 8 comments
Closed

Django error when reading json response #39

eironman opened this issue Nov 24, 2016 · 8 comments

Comments

@eironman
Copy link

eironman commented Nov 24, 2016

Hello,
I started using clarifai with django, in the home view when I tried to use the example provided in README:

app = ClarifaiApp('xxxxxxxx', 'xxxxxxxx') model = app.models.get('general-v1.3') print(model.predict_by_url('https://samples.clarifai.com/metro-north.jpg'))

An error raised:

TypeError at /
the JSON object must be str, not 'bytes'

Debugging I found that if I commented the line 2223 in the file clarifi/rest/client.py, everything was fine:

logger.debug("\nRESULT:\n%s", pformat(json.loads(res.content)))

Is there anything unproperly configured in my side or is it a library issue? Thanks for any help provided.

@sevazhidkov
Copy link

+1

@robertwenquan
Copy link
Contributor

Hi @eironman @sevazhidkov May I ask what python version are you using?

@kender99
Copy link

I get this error too. But only on Linux
on Windows the exact same code
when calling model.xxxx produces no error
python 3.5

@kender99
Copy link

Going back to version 2.0.11 solved this problem for me.
but on version 2.0.11 you have to manually comment out a line that says
print 'bbbbbbbbbbbbbbbbbbbbbbb'
on the api source code , or that will bring it down instead.

@robertwenquan
Copy link
Contributor

robertwenquan commented Nov 28, 2016 via email

@robertwenquan
Copy link
Contributor

Hi @kender99 @eironman This issue is a python3 compatibility issue.
It should be addressed in v2.0.14 that was released a min ago.

Thanks again for reportnig the issue. I am closing the issue right now.

@kender99
Copy link

kender99 commented Nov 28, 2016 via email

@eironman
Copy link
Author

Sorry, I had notifications deactivated in the settings (I changed it right now) and didn't see the answers.
Many thanks!

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

4 participants