Title: nltk is not working properly
Type: compile error Stage: resolved
Components: Library (Lib) Versions: Python 3.6
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.

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 "", line 1, in <module>
    from nltk.tokenize import word_tokenize, sent_tokenize
  File "D:\PYTHON36\lib\site-packages\nltk\", line 89, in <module>
    from nltk.internals import config_java
  File "D:\PYTHON36\lib\site-packages\nltk\", line 11, in <module>
    import subprocess
  File "D:\PYTHON36\lib\", line 126, in <module>
    import threading
  File "D:\PYTHON36\lib\", line 7, in <module>
    from traceback import format_exc as _format_exc
  File "D:\PYTHON36\lib\", line 5, in <module>
    import linecache
  File "D:\PYTHON36\lib\", line 11, in <module>
    import tokenize
  File "D:\PYTHON36\lib\", line 35, in <module>
    from token import *
  File "C:\Users\Ali Abbas\Desktop\token\", line 1, in <module>
    from nltk.tokenize import word_tokenize, sent_tokenize
  File "D:\PYTHON36\lib\site-packages\nltk\tokenize\", line 67, in <m
    from nltk.tokenize.mwe      import MWETokenizer
  File "D:\PYTHON36\lib\site-packages\nltk\tokenize\", line 31, in <module
    from nltk.util import Trie
  File "D:\PYTHON36\lib\site-packages\nltk\", line 15, in <module>
    import pydoc
  File "D:\PYTHON36\lib\", 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\" file hides the standard token module.
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