problems with nltk

Katja Filippova ephilpva at sfs.uni-tuebingen.de
Mon Mar 22 08:47:45 EST 2004


hi,

Has anybody tried using natural language toolkit 
(http://nltk.sourceforge.net/) under Python (my version is 2.1.1)?

problems:
first, I wanted to import a module, as it is written in the manual, but 
it didn't work:
 >>> from nltk.token import *
Traceback (most recent calls last):
    File "<stdin>", line 1, in ?
ImportError: No module named nltk.token

since there was such module I thought that Python simply didn't look for 
it in the right directory and I rewrote the path:

import sys, os
SRCDIR="/home/name/nltk-1.3"
sys.path.append(SRCDIR)
print sys.path

After that the error message changed to:

 >>> from nltk.token import *
Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "__init__.py", line 49, in ?
        ----------------
    File "/...........python211/lib/python2.1/lib-tk/Tkinter.py", line 
35, in ?
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.3.so: cannot open shared object file: No such file 
or directory

Then I typed import _tkinter but it didn't help, I got the same error 
message as before:

    File "/...........python211/lib/python2.1/lib-tk/Tkinter.py", line 
35, in ?
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.3.so: cannot open shared object file: No such file 
or directory

If I try to import the module again I get:

Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "/home/name/nltk-1.3/nltk/token.py", line 308
        yield self._deep_restrict(item, props, incl)
                    ^
SyntaxError: invalid syntax

Does it really mean that Python is not configured for Tk? What does 
"<stdin>" mean? Is it the problem with nltk rather than with Python?

thanx in advance,
Katja





More information about the Python-list mailing list