A
A
almaska2020-09-02 19:58:00
Python
almaska, 2020-09-02 19:58:00

When I write code, an invalid syntax error occurs, what should I do?

It throws an error
Here is the code:

import telebot
import config

bot = telebot.TeleBot(config.TOKEN)

@bot.message_handler(commands=["start"])
def welcome(message):
    sti = open("static/welcome.webp", "rb")
    bot.send_sticker(message.chat.id, sti)

    bot.send_message(message.chat.id , "Добро пожаловать, {0.first_name}!\nЯ -  </b>{1.first_name}, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me())
    	parse_mode="html")


@bot.message_handler(content_types=["text"])
def lalala(message):
  bot.send_message(message.chat.id, message.text)

#RUN
bot.polling(none_stop=True)


-------------------------------------------------

c:\Python>python bot.py
  File "bot.py", line 12
    parse_mode="html")
    ^
SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Ternick, 2020-09-02
​​@almaska

Lost a comma!

import telebot
import config

bot = telebot.TeleBot(config.TOKEN)

@bot.message_handler(commands=["start"])
def welcome(message):
sti = open("static/welcome.webp", "rb")
bot.send_sticker(message.chat.id, sti)

bot.send_message(message.chat.id , "Добро пожаловать, {0.first_name}!\nЯ - {1.first_name}, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me()),
parse_mode="html")

@bot.message_handler(content_types=["text"])
def lalala(message):
bot.send_message(message.chat.id, message.text)

#RUN
bot.polling(none_stop=True)

Here in this line (12):
bot.send_message(message.chat.id , "Welcome, {0.first_name}!\nI am {1.first_name}, a bot designed to be a guinea pig.".format(message. from_user, bot.get_me()) ,
parse_mode="html")

S
SKEPTIC, 2020-09-02
@pro100chel

1. The code must be wrapped in a tag on the toaster.
2. The code is invalid - that's why the error.

A
Alexander Pikeev, 2020-09-02
@Baryon

It is written in black and white that the programmer is disabled.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question