classification
Title: nltk is not working properly
Type: compile error Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Ali Abbas, serhiy.storchaka
Priority: normal Keywords:

Created on 2018-04-09 03:07 by Ali Abbas, last changed 2018-04-09 08:15 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
error.txt Ali Abbas, 2018-04-09 03:07
Messages (2)
msg315106 - (view) Author: Ali Abbas (Ali Abbas) Date: 2018-04-09 03:07
nltk is not working properly, showing this error

Traceback (most recent call last):
  File "token.py", line 1, in <module>
    from nltk.tokenize import word_tokenize, sent_tokenize
  File "D:\PYTHON36\lib\site-packages\nltk\__init__.py", line 89, in <module>
    from nltk.internals import config_java
  File "D:\PYTHON36\lib\site-packages\nltk\internals.py", line 11, in <module>
    import subprocess
  File "D:\PYTHON36\lib\subprocess.py", line 126, in <module>
    import threading
  File "D:\PYTHON36\lib\threading.py", line 7, in <module>
    from traceback import format_exc as _format_exc
  File "D:\PYTHON36\lib\traceback.py", line 5, in <module>
    import linecache
  File "D:\PYTHON36\lib\linecache.py", line 11, in <module>
    import tokenize
  File "D:\PYTHON36\lib\tokenize.py", line 35, in <module>
    from token import *
  File "C:\Users\Ali Abbas\Desktop\token\token.py", line 1, in <module>
    from nltk.tokenize import word_tokenize, sent_tokenize
  File "D:\PYTHON36\lib\site-packages\nltk\tokenize\__init__.py", line 67, in <m
odule>
    from nltk.tokenize.mwe      import MWETokenizer
  File "D:\PYTHON36\lib\site-packages\nltk\tokenize\mwe.py", line 31, in <module
>
    from nltk.util import Trie
  File "D:\PYTHON36\lib\site-packages\nltk\util.py", line 15, in <module>
    import pydoc
  File "D:\PYTHON36\lib\pydoc.py", line 72, in <module>
    from traceback import format_exception_only
ImportError: cannot import name 'format_exception_only'
msg315115 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-09 08:15
nltk is not a part of the stdlib, it a third-party library.

But in this case seems the problem is in your code or configuration. Your "C:\Users\Ali Abbas\Desktop\token\token.py" file hides the standard token module.
History
Date User Action Args
2018-04-09 08:15:16serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg315115

resolution: third party
stage: resolved
2018-04-09 03:07:30Ali Abbascreate