Error : No module named 'actions'


(Smitty Hoffmann) #1

Hi all. I try to start a bot from a Java-Programm and getting an error i can’t really fix: My Python-Code is :

 print(os.getcwd())
    logging.basicConfig(level='INFO')
    arg_parser = create_argument_parser()
    cmdline_args = arg_parser.parse_args()
    print(cmdline_args.nlu)
    print(cmdline_args.core)




    interpreter = RasaNLUInterpreter(cmdline_args.nlu)
    agent = Agent.load(cmdline_args.core,interpreter= interpreter)
    print("Bot geladen")

    if True:
        agent.handle_channel(ConsoleInputChannel())

The prints are for testing purposes and give: C:\Users\Chris\Desktop\WeatherBot --> currentWorkingDirectoy ./models/nlu/default/weathernlu/ --> path to nlumodel ./models/dialogue/coreModel/ --> path to coremodel

Still i get the error: No module named ‘actions’ I have an actions.py file in the WorkingDirectory so why isn’t it found?

it’s also in the same directory like my domain.yml

The python script i call to run the bot isnt in the bot-project directory. is this the problem?


(Akela Drissner) #2

Try adding an empty __init__.py to that folder and see if it works then :slight_smile:


(Smitty Hoffmann) #3

Didn’t work.

My runBot.py is in C:\Users\Chris\IdeaProjects\RasaStackMate\src\main\pythonProcessing. My domain and actionFile is in C:\Users\Chris\Desktop\Rasa_Stuff\Weatherbot My coremodel is in C:\Users\Chris\Desktop\Rasa_Stuff\Weatherbot\models\dialogue\coremodel

runBot.py calls agent.load and gives me the error… Does runBot.py have to be in the same directory as my action.py and domain.yml? I also tried to set the workingDirectory to C:\Users\Chris\Desktop\Rasa_Stuff\Weatherbot but no success…


(Akela Drissner) #4

Ok yes the runbot.py should be in the same directory. If you want it to be in a different directory then you have to make your bot a package and install it and call the action like this weatherbot.actions.action_name