0

I am trying to run the below code:

import nltk
nltk.download()

I get the NLTK downloader where I select Corpora tab and try to download wordnet (or any other file) I am getting the below error

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 495, in callit
    func(*args)
  File "C:\Python27\lib\site-packages\nltk\downloader.py", line 1914, in _monitor_message_queue
    self._select(msg.package.id)
AttributeError: 'unicode' object has no attribute 'id'

Process finished with exit code -805306369 (0xCFFFFFFF) 

and

<urlopen error [Errno 10109] getaddrinfo failed>

I believe it's a network issue, how can I resolve it? (Just an FYI, I can connect to the internet and browse normally)

user2810706
  • 107
  • 3
  • 12
  • Can you figure out which host it fails to resolve? What version of NLTK? – tripleee Oct 01 '15 at 03:22
  • Tangentially, can you check that it's not one of the issues on http://stackoverflow.com/questions/22211525/how-do-i-download-nltk-data – tripleee Oct 01 '15 at 03:33
  • @tripleee: Not sure which host failed to resolve... My version of NLTK is 3.0.5... I have checked the post but no luck – user2810706 Oct 01 '15 at 15:16
  • I'm not too sure it's a network issue. Try using the downloader non-interactively, e.g. `nltk.download("brown")`; if the problem remains, at least you know it's not in the tk window handler. If you have python 3 on your computer, try the download there as well. – alexis Oct 01 '15 at 15:45

1 Answers1

0

I recommend that you avoid Tkinter. You can install corpora from the command line like this sudo python nltk.downloader wordnet. To download all corpora required for using the book, do python nltk.downloader book.

user1611867
  • 301
  • 1
  • 2