Python error in Def _init_ function when creating a Chatbot

Asked

Viewed 244 times

0

class wppbot:
    dir_path = os.getcwd()
    bot.def __init__(self, nome_bot):
        self.bot = ChatBot(nome_bot)
        self.bot.set_trainer(ListTrainer)
        self.chrome = self.dir_path+'\chromedriver.exe'
        self.options = webdriver.ChromeOptions()
        self.options.add_argument(r"user-data-dir="+self.dir_path+"\profile\wpp")
        self.driver = webdriver.Chrome(self.chrome, chrome_options=self.options)

I’m having an error in this part of the code, it says there is a syntax error in bot.def. I’m learning now, so any help is welcome.

  • 1

    What would that be "bot." before def in the third row?

  • Ah, I think I get it. The mistake is because there is nothing in the bot? I got this part already like this.

  • No, because the Python syntax is wrong: https://docs.python.org/3.7/tutorial/classes.html

1 answer

0


Remove the part of the third line where there is

bot.def __init__(self, nome_bot):

This syntax is wrong, see.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.