wit-ai / pywit

Python library for Wit.ai
Other
1.45k stars 359 forks source link

Object of type 'bytes' is not JSON serializable #91

Closed salehinRafi closed 6 years ago

salehinRafi commented 7 years ago

I encounter this problem when I try to follow messenger.py example. I try use Bottle and Flask. The Same problem occurs.

**o.__class__.__name__)
   TypeError: Object of type 'bytes' is not JSON serializable**

When I change this line 88 in pywit/examples/messenger.py code as below::-

data = {
        'recipient': {'id': sender_id},
        'message': {'text': text.decode('utf-8')}
    }

The problem is resolved.

I use ngrok, virtualenv as my environment development.

PineLover commented 6 years ago

original was

data = { 'recipient': {'id': sender_id}, 'message': {'text': text} }