ChatterBot icon indicating copy to clipboard operation
ChatterBot copied to clipboard

ImportError: cannot import name ChatBot

Open Mrtenz opened this issue 10 years ago • 10 comments

I copied an example, but get this when executing it:

Traceback (most recent call last):
  File "chatterbot.py", line 1, in <module>
    from chatterbot import ChatBot
  File "/root/taartbot/chatterbot.py", line 1, in <module>
    from chatterbot import ChatBot
ImportError: cannot import name ChatBot

Mrtenz avatar Apr 05 '16 14:04 Mrtenz

This is a circular import error. You named your file chatterbot.py, then imported from chatterbot. To fix this rename your chatterbot.py in /root/taartbot/ to something else.

gunthercox avatar Apr 05 '16 19:04 gunthercox

Thanks, I was having same problem

97997 avatar May 17 '17 22:05 97997

i am trying to run this file name runtests.py but it show me this error can you please help to find aout the problem

File "C:\Users\Dhanesh\Desktop\Check it Please\ChatterBot-master\tests_django_init_.py", line 1, in from .statement import Statement ImportError: No module named 'tests_django.statement'

DhaneshKumarHeerani avatar Dec 14 '17 06:12 DhaneshKumarHeerani

@DhaneshKumarHeerani If you are trying to run the tests for this project, please use the command python runtests.py, this will run the test suite for Django.

gunthercox avatar Dec 14 '17 12:12 gunthercox

yes i did but it's not running i checked it showing this error

C:\Users\Dhanesh\Desktop\Check it Please\ChatterBot-master>python runtests.py
Traceback (most recent call last):
  File "runtests.py", line 16, in <module>
    django.setup()
  File "C:\Users\Dhanesh\AppData\Local\Programs\Python\Python35\lib\site-packages\django\__init__.py", line 17, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "C:\Users\Dhanesh\AppData\Local\Programs\Python\Python35\lib\site-packages\django\conf\__init__.py", line 55, in __getattr__
    self._setup(name)
  File "C:\Users\Dhanesh\AppData\Local\Programs\Python\Python35\lib\site-packages\django\conf\__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "C:\Users\Dhanesh\AppData\Local\Programs\Python\Python35\lib\site-packages\django\conf\__init__.py", line 99, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "C:\Users\Dhanesh\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'mysite'
`` 

DhaneshKumarHeerani avatar Dec 15 '17 06:12 DhaneshKumarHeerani

try to add current directory your python path I am not sure which operating system you are using, this command will work on Ubuntu export PYTHONPATH=${PYTHONPATH}:.

vkosuri avatar Dec 15 '17 11:12 vkosuri

Well its the same issue i renamed it to inquiry but still not worked Traceback (most recent call last): File "inquiry.py", line 1, in from chatterbot import Chatbot ImportError: cannot import name 'Chatbot'

sapreparth avatar Mar 20 '18 17:03 sapreparth

check the spelling once again.it is "ChatBot" not Chatbot.Hope it works fine

krishnakumarmoorthy avatar Aug 19 '18 15:08 krishnakumarmoorthy

LMAO I just lost 1 hour with this.

OtacilioN avatar Mar 09 '19 19:03 OtacilioN

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 04 '20 20:01 lock[bot]