import os
import time
import pip
import telebot
from telebot import types
from background import keep_alive # Import function for functionality support
pip.main(['install', 'pytelegrambotapi'])
and it gives an error in the console
ModuleNotFoundError: No module named 'pip'
KAlexK
October 26, 2023, 6:23am
2
pip.main([‘install’, ‘pytelegrambotapi’])
Этот фрагмент кода является частью ошибки и частью вашего кода?
Is this code snippet part of the error and part of your code?
yes ,
Traceback (most recent call last):
File "/home/runner/Python/main.py", line 3, in <module>
import pip
ModuleNotFoundError: No module named 'pip'
My all code
import os
import time
import pip
import telebot
from telebot import types
from background import keep_alive # Import function for functionality support
pip.main(['install', 'pytelegrambotapi'])
token = '/'
bot = telebot.TeleBot(token)
@bot.message_handler(commands=['start'])
def start(message):
markup = types.InlineKeyboardMarkup()
button1 = types.InlineKeyboardButton(
"//",
url='/')
markup.add(button1)
bot.send_message(
message.chat.id,
"///"
.format(message.from_user),
reply_markup=markup)
bot.polling(none_stop=True)
KAlexK
October 26, 2023, 6:29am
4
Вы можете удалить эту строку pip.main(['install', 'pytelegrambotapi'])
, а затем ввести в Shell эту команду: pip install pyTelegramBotAPI
.
You can delete this line pip.main(['install’, 'pytelegrambotapi'])
, and then enter this command into the Shell: pip install pyTelegramBotAPI
.
when I enter it into the Shell, it enters me like this
pip is using a content-addressable pool to install files from.
This experimental feature is enabled through --use-feature=content-addressable-pool and it is not ready for production.
KAlexK
October 26, 2023, 6:35am
7
Can you provide a link to your repl?
Maybe I’ll write you a telegram
and where can I get this link
tihghts
October 26, 2023, 6:55am
11
KAlexK
October 26, 2023, 6:59am
14
Yes, if it does not contain API keys not recorded in secrets.
tihghts
October 26, 2023, 7:04am
16
KAlexK
October 26, 2023, 7:07am
17
Corrected code:
import os
import time
import telebot
from telebot import types
from background import keep_alive # Import function for functionality support
token = 'xxxxxxx'
bot = telebot.TeleBot(token)
@bot.message_handler(commands=['start'])
def start(message):
markup = types.InlineKeyboardMarkup()
button1 = types.InlineKeyboardButton("xxxx", url='xxxx')
markup.add(button1)
bot.send_message(message.chat.id,
"xxxxx".format(message.from_user),
reply_markup=markup)
bot.polling(none_stop=True)
I have removed the import and use of the pip
module. Try running this code.
tihghts
October 26, 2023, 7:08am
18
KAlexK:
import os
import time
import telebot
from telebot import types
from background import keep_alive # Import function for functionality support
token = 'xxxxxxx'
bot = telebot.TeleBot(token)
@bot.message_handler(commands=['start'])
def start(message):
markup = types.InlineKeyboardMarkup()
button1 = types.InlineKeyboardButton("xxxx", url='xxxx')
markup.add(button1)
bot.send_message(message.chat.id,
"xxxxx".format(message.from_user),
reply_markup=markup)
bot.polling(none_stop=True)
спасибо а как теперь сделать приватным?
thank you, but how do I make it private now?
KAlexK
October 26, 2023, 7:13am
20
Вы можете отметить пост, который помог вам больше всего, как решение. Так другие пользователи, который столкнуться с такой же проблемой будут знать, как её исправить.
You can mark the post that helped you the most as a solution. So other users who encounter the same problem will know how to fix it.
1 Like
That is a warning, not an error.
2 Likes