'NoneType' object has no attribute 'kill_cursors' when nltk is imported

696 views Asked by At

If I use a pymongo cursor and have the nltk package imported, I get this error. I'm not sure if this is a bug, or if I can fix this somehow:

Exception ignored in: <bound method Cursor.__del__ of <pymongo.cursor.Cursor object at 0x054D0210>>
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\pymongo-3.0.2-py3.4-win32.egg\pymongo\cursor.py", line 211, in __del__
  File "C:\Python34\lib\site-packages\pymongo-3.0.2-py3.4-win32.egg\pymongo\cursor.py", line 271, in __die
  File "C:\Python34\lib\site-packages\pymongo-3.0.2-py3.4-win32.egg\pymongo\mongo_client.py", line 833, in close_cursor
  File "C:\Python34\lib\site-packages\pymongo-3.0.2-py3.4-win32.egg\pymongo\cursor_manager.py", line 56, in close
AttributeError: 'NoneType' object has no attribute 'kill_cursors'

I'm using Python 3.4, Pymongo 3.0.2, and nltk 3.0.2.

Here is a simple script I can use to reproduce the error:

from pymongo import MongoClient
import nltk

client = MongoClient()
db = client.test
coll = db.restaurants

curs = coll.find()
curs.next()

Any help is appreciated!

Thanks

EDIT: This error occurs only when nltk is imported. If I comment the import nltk line out, the error does not occur.

0

There are 0 answers