ascii codec error when performing query using python 3.2

Issue #395 resolved
Anonymous created an issue

While running a query from python 3.2 this error occurs while running the line

results =

if this is an error on my part I appologize,

The traceback is below,

Thank you

Exception happened during processing of request from ('', 36235)

Traceback (most recent call last):

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/", line 581, in process_request_thread self.finish_request(request, client_address)

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/", line 323, in finish_request self.RequestHandlerClass(request, client_address, self)

File "", line 19, in init RequestHandler.init(self,request,client_address, server)

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/", line 637, in init self.handle()

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/http/", line 396, in handle self.handle_one_request()

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/http/", line 384, in handle_one_request method()

File "", line 39, in do_GET rtn =['q'][0]))

File "/big/thtownsend/dev/install/rms/resource/helpfiles/", line 21, in search results =

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/site-packages/whoosh/", line 787, in search self.search_with_collector(q, c)

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/site-packages/whoosh/", line 820, in search_with_collector

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/site-packages/whoosh/", line 144, in run self.collect_matches()

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/site-packages/whoosh/", line 214, in collect_matches for sub_docnum in self.matches():

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/site-packages/whoosh/", line 415, in matches yield

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/site-packages/whoosh/codec/", line 910, in id self._read_ids()

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/site-packages/whoosh/codec/", line 1012, in _read_ids self._read_data()

File "/big/thtownsend/dev/install/rms/linux-amd64-gcc_4_4-debug/lib/python3.2/site-packages/whoosh/codec/", line 1007, in _read_data self._data = loads(b)

UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 4: ordinal not in range(128)

Comments (4)

  1. Thomas Townsend

    this is the entire code for running the query

    schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
    ix = open_dir('/big/thtownsend/dev/install/rms/resource/helpfiles/_static')
    from whoosh.qparser import QueryParser
    def search(q):
        with ix.searcher() as searcher:
            query = QueryParser("content", ix.schema).parse(str(q), debug=True)
            results =
            rtn = []
            tmp = ''
            for r in results:
                tmp += r+'\n'
  2. superkelvint

    I had this same error on Python 3.4 and made it go away by rebuilding my index. I think my original index was built on 2.7 and ran into this error when running it on 3.4. I wonder if you're in the same boat? If so, try rebuilding your index on 3.x?

  3. Matt Chaput repo owner

    To reindex, you need to delete the existing index and somehow (depending on your code) add all the existing documents to the index again. Sorry about the trouble!

  4. Log in to comment