简体   繁体   中英

TypeError: 'module' object is not callable , how can i fix it?

Why am I getting this error?

File "e:\Python\My Python.py", line 15, in main

 dp.add_handler((commandhandler('bop',bop)))

TypeError: 'module' object is not callable

Don't know what library you are using but I suppose that add_handler or commandhandler is not a function. The Interpreter is telling you that your are using a module as a function or a method.

EDIT: Ok, you are using python-telegram-bot. As you can see here , at line 39, CommandHandler is the class you can use in that context. commandhandler is the file that contains it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM