isagalaev / ijson

Iterative JSON parser with Pythonic interface
http://pypi.python.org/pypi/ijson/
Other
615 stars 134 forks source link

TypeError with Python 3.6 #61

Closed groutr closed 7 years ago

groutr commented 7 years ago

With yajl 2.1.0 and cffi 1.9.1

import ijson.backends.yajl2_cffi as ijson
f = next(ijson(open('json_file.json', 'r')))

produces

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-468f0afdf1b9> in <module>()
----> 1 next(f)

./py36/lib/python3.6/site-packages/ijson-2.3-py3.6.egg/ijson/common.py in parse(basic_events)
     63     '''
     64     path = []
---> 65     for event, value in basic_events:
     66         if event == 'map_key':
     67             prefix = '.'.join(path[:-1])

./py36/lib/python3.6/site-packages/ijson-2.3-py3.6.egg/ijson/backends/yajl2_cffi.py in basic_parse(f, buf_size, **config)
    216             # this calls the callbacks which will
    217             # fill the events list
--> 218             yajl_parse(handle, buffer)
    219
    220             if not buffer and not events:

./py36/lib/python3.6/site-packages/ijson-2.3-py3.6.egg/ijson/backends/yajl2_cffi.py in yajl_parse(handle, buffer)
    177 def yajl_parse(handle, buffer):
    178     if buffer:
--> 179         result = yajl.yajl_parse(handle, buffer, len(buffer))
    180     else:
    181         result = yajl.yajl_complete_parse(handle)

TypeError: initializer for ctype 'unsigned char *' must be a bytes or list or tuple, not str
groutr commented 7 years ago

Duplicate of #54 (my bad)