Revolution1 / Flask-WhooshAlchemyPlus

Whoosh indexing capabilities for Flask-SQLAlchemy, Flask-WhooshAlchemy plus some improvement

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

不支持python3如何修改呢?

zhao94254 opened this issue · comments

一直报这个错误 ,不知道该如何修改。
File "E:\py3\lib\site-packages\whoosh\matching\wrappers.py", line 302, in _find_next
child = self.child
ids = self._ids
r = False

    if self._exclude:
        while child.is_active() and child.id() in ids:
            r = child.next() or r
    else:
        while child.is_active() and child.id() not in ids:
            r = child.next() or r
    return r

File "E:\py3\lib\site-packages\whoosh\codec\whoosh3.py", line 980, in id
self._read_ids()
File "E:\py3\lib\site-packages\whoosh\codec\whoosh3.py", line 1083, in _read_ids
self._data = loads(b)

def _read_ids(self):
    # If we haven't loaded the data from disk yet, load it now
    if self._data is None:
        self._read_data()
    ids = self._data[0]

    # De-minify the IDs
    if not self._byteids:
        ids = tuple(delta_decode(ids))

File "E:\py3\lib\site-packages\whoosh\codec\whoosh3.py", line 1078, in _read_data
if self._compression:
b = zlib.decompress(b)

    # U
    # npickle the data tuple and save it in an attribute
    self._data = loads(b)

def _read_ids(self):
    # If we haven't loaded the data from disk yet, load it now
    if self._data is None:

Open an interactive python shell in this frame self._read_data()
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 4: ordinal not in range(128)


File "E:\py3\lib\site-packages\whoosh\codec\whoosh3.py", line 1078, in _read_data
if self._compression:
b = zlib.decompress(b)

# U
# npickle the data tuple and save it in an attribute
self._data = loads(b)

将loads(b) 改为 loads(b, encoding='latin-1')就可以了

看来是 whoosh 的问题啊,你可以给 whoosh 项目提 pr