Advertisement
saimanoj

IO operation on closed file

Aug 31st, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. def query(self, query_str):
  2.     qp = QueryParser("content", ix.schema)
  3.     q = qp.parse(unicode(query_str))
  4.     with self.ix.searcher() as searcher:
  5.         results = searcher.search(q)
  6.     return results
  7. and using results later in some other code raises this error,
  8.   File "main.py", line 62, in <module>
  9.     main()
  10.   File "main.py", line 57, in main
  11.     print result
  12.   File "/usr/lib/python2.7/dist-packages/whoosh/searching.py", line 1469, in __repr__
  13.     return "<%s %r>" % (self.__class__.__name__, self.fields())
  14.   File "/usr/lib/python2.7/dist-packages/whoosh/searching.py", line 1377, in fields
  15.     self._fields = self.searcher.stored_fields(self.docnum)
  16.   File "/usr/lib/python2.7/dist-packages/whoosh/filedb/filereading.py", line 136, in stored_fields
  17.     return dict(item for item in iteritems(self._stored[docnum])
  18.   File "/usr/lib/python2.7/dist-packages/whoosh/codec/whoosh2.py", line 899, in __getitem__
  19.     dbfile.seek(start)
  20. ValueError: I/O operation on closed file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement