Answer the question
In order to leave comments, you need to log in
Why does it throw an error: TypeError: open() takes 1 positional argument but 2 were given?
I don’t understand why it gives me an error TypeError: open() takes 1 positional argument but 2 were given, because before everything worked fine, but now this.
Code snippet with an error:
@bot.message_handler(commands = ['screenshot'])
def screenshot(message):
pg.screenshot('screenshot.png')
with open('screenshot.png', 'rb') as img:
bot.send_photo(message.chat.id, img)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question