alfredfrancis / ai-chatbot-framework

A python chatbot framework with Natural Language Understanding and Artificial Intelligence.
MIT License
1.97k stars 712 forks source link

TypeError: the JSON object must be str, not 'bytes' in app/stories/controllers.py", line 82, in updateStory #62

Closed marlonleite closed 6 years ago

marlonleite commented 6 years ago

Hello, Its application is very cool. Thank you for having documented and provided this to us. So, I tested every application in the macos and everything worked perfectly. But I'm having trouble using this on ubuntu server in the production environment. Everything was installed with nginx, supervised, mongodb and virtualenv. The problem occurs when I try to update Story information. The updateStory function gives TypeError error: the JSON object must be str, not 'bytes'. I've tried converting json to utf-8 but the error remains. Some help is welcome. Thank you

marlonleite commented 6 years ago

OK, after many attempts I was able to correct the error. Actually this has to do with python 3.5 on ubuntu. In macos the version of python is 3.6.

To fix the error, just add in the jsondata variable as_text = True.

jsondata = loads (request.get_data (as_text = True))

This is to allow the updateStory method of the correct parser in json.

Anyway the application is very cool. I would like to improve it for Brazilian Portuguese.

alfredfrancis commented 6 years ago

Cool. You are welcome to do a pull request for Portuguese.