0

I have installed this python module https://github.com/gunthercox/ChatterBot and now I downloaded the project to modify things locally. The problem is that when I execute an example of the examples folder, it still loads the installed package. I tried Importing modules from parent folder but it says:

import os,sys,inspect 
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.curr‌​entframe()))) 
parentdir = os.path.dirname(currentdir) 
sys.path.insert(0,parentdir)    
import chatterbot

Parent module '' not loaded, cannot perform relative import

I think it will only work for simple .py files, not an entire project. Tried this answer from the same question and it worked but broke for all the other imports inside the project.

Shouldn't these examples be adapted to work locally already, as they're rapidly tested by the developer? How to import the package locally?

Community
  • 1
  • 1
Gatonito
  • 1,662
  • 5
  • 26
  • 55
  • Please show your `import` statement. – DYZ Jan 25 '17 at 05:39
  • @DYZ its this one https://github.com/gunthercox/ChatterBot/blob/master/examples/basic_example.py – Gatonito Jan 25 '17 at 05:54
  • Nope. _Your_ `import` statement - the one that actually causes the error. – DYZ Jan 25 '17 at 05:58
  • @DYZ import os,sys,inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentdir) import chatterbot – Gatonito Jan 25 '17 at 06:08

0 Answers0