ananas
ananas copied to clipboard
TypeError: 'module' object is not callable
https://github.com/chr-1x/ananas/blob/e4625a3da193fa1c77119edb68d4ee18dcbc56ca/ananas/run.py#L43
I've had an issue with this line, and had to change it to the following one in order to make my project working:
exec("from {0}.{1} import {1}; bots.append({1}('{2}', name='{3}', interactive={4}, verbose={5}))"
I've got a bot python file in custom/ArchiveBot.py and my config.cfg contains the following class: class = custom.ArchiveBot
With the current line exec("from {0} import {1}, it return the following error:
/home/alx/.local/bin/ananas: fatal exception loading bot archive_bot: TypeError("'module' object is not callable",)
Traceback (most recent call last):
File "/home/alx/.local/lib/python3.6/site-packages/ananas/run.py", line 44, in main
.format(module, botclass, args.config, bot, args.interactive, args.verbose))
File "<string>", line 3, in <module>
TypeError: 'module' object is not callable
I'm new to python, my project file structure is probably wrong
This could be a python version issue, I think I tested on 3.5. I'll look into it this weekend maybe.
I know I'm almost a year late to this, but the correct spec for your class in this case would be custom.ArchiveBot.ArchiveBot. With the former, it's trying to use the module object as your bot class. With the one I've provided, it should probably work.