You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.
Traceback (most recent call last):
File "foo.py", line 14, in <module>
foo.write(proto.TJSONProtocol(buff))
File "/Users/gustavofonseca/prj/envs/thrift/lib/python2.7/site-packages/thriftpy/thrift.py", line 93, in write
oprot.write_struct(self)
File "/Users/gustavofonseca/prj/envs/thrift/lib/python2.7/site-packages/thriftpy/protocol/json.py", line 206, in write_struct
"payload": struct_to_json(obj)
File "/Users/gustavofonseca/prj/envs/thrift/lib/python2.7/site-packages/thriftpy/protocol/json.py", line 129, in struct_to_json
outobj[field_name] = json_value(field_type, v, field_type_spec)
File "/Users/gustavofonseca/prj/envs/thrift/lib/python2.7/site-packages/thriftpy/protocol/json.py", line 23, in json_value
return str(val)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe3' in position 1: ordinal not in range(128)
foo.thrift:
struct Foo {
1: optional string name;
}
foo.py:
# coding: utf-8
import io
import thriftpy
import thriftpy.protocol.json as proto
thrift_spec = thriftpy.load('foo.thrift', module_name='foo_thrift')
foo = thrift_spec.Foo(name=u'pão de açúcar')
#print proto.struct_to_json(foo)
buff = io.BytesIO()
foo.write(proto.TJSONProtocol(buff))
print buff.getvalue()
The text was updated successfully, but these errors were encountered:
Hi all! This is the traceback:
foo.thrift:
foo.py:
The text was updated successfully, but these errors were encountered: