error problems for import some copora with nltk

Tony Meyer t-meyer at ihug.co.nz
Tue Dec 21 21:54:24 EST 2004


> I am trying to follow the tutorial, but I kept getting error messages
> about importing corpus as follows
> 
> ===================================================
> >>> from nltk.corpus import gutenberg
> 
> Traceback (most recent call last):
> File "<pyshell#3>", line 1, in -toplevel-
> from nltk.corpus import gutenberg
> ImportError: cannot import name gutenberg
> ===================================================
> 
> I got the data files under c:\\python24\nltk\

Have you imported nltk before that line?  Try this:

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> from nltk.corpus import gutenberg

I suspect you may be doing this:

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from nltk.corpus import gutenburg
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: cannot import name gutenburg

Note that if the corpus can't be found, you can still do the import (just
not use the corpus).

=Tony.Meyer




More information about the Python-list mailing list