-
Автор темы
- #1
есть такой код
если использую для запуска python main.py, все запускается, но я хочу собрать его в exeшник, прописываю
и начинает вылетать ошибка
Код:
@router.message(CommandStart())
async def cmd_help(message: Message,state : FSMContext):
await state.clear()
file_path = "app/other/image.jpg"
await message.reply_photo(
photo = FSInputFile(
path=file_path
)
)
Код:
pyinstaller --onefile --add-data "C:\Users\Админ\Desktop\tgbot\app\other\tgbotinok.dll;." --add-data "C:\Users\Админ\Desktop\tgbot\app\image.jpg;." -F -i "C:\Users\Админ\Desktop\tgbot\icon.ico" main.py
Код:
TelegramNetworkError: HTTP Client says - ClientOSError: [Errno 2] Can not write request body for https://api.telegram.org/ bottoken:)/sendPhoto Traceback (most recent call last): File "aiohttp\client_reqrep.py", line 637, in write_bytes File "aiohttp\multipart.py", line 993, in write File "aiohttp\payload.py", line 442, in write File "aiogram\types\input_file.py", line 103, in read File "aiofiles\base.py", line 98, in aenter File "aiofiles\threadpool_init_.py", line 94, in _open File "concurrent\futures\thread.py", line 58, in run FileNotFoundError: [Errno 2] No such file or directory: 'app/other/image.jpg'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "aiogram\client\session\aiohttp.py", line 181, in make_request
File "aiohttp\client.py", line 1353, in __aenter__
File "aiohttp\client.py", line 684, in _request
File "aiohttp\client_reqrep.py", line 999, in start
File "aiohttp\streams.py", line 640, in read
aiohttp.client_exceptions.ClientOSError: [Errno 2] Can not write request body for bottoken:) /sendPhoto
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "aiogram\dispatcher\dispatcher.py", line 309, in _process_update
File "aiogram\dispatcher\dispatcher.py", line 158, in feed_update
File "aiogram\dispatcher\middlewares\error.py", line 25, in __call__
File "aiogram\dispatcher\middlewares\user_context.py", line 56, in __call__
File "aiogram\fsm\middleware.py", line 42, in __call__
File "aiogram\dispatcher\event\telegram.py", line 121, in trigger
File "aiogram\dispatcher\event\handler.py", line 43, in call
File "aiogram\dispatcher\dispatcher.py", line 276, in _listen_update
File "aiogram\dispatcher\router.py", line 146, in propagate_event
File "aiogram\dispatcher\router.py", line 141, in _wrapped
File "aiogram\dispatcher\router.py", line 174, in _propagate_event
File "aiogram\dispatcher\router.py", line 146, in propagate_event
File "aiogram\dispatcher\router.py", line 141, in _wrapped
File "aiogram\dispatcher\router.py", line 166, in _propagate_event
File "aiogram\dispatcher\event\telegram.py", line 121, in trigger
File "aiogram\dispatcher\event\handler.py", line 43, in call
File "app\handlers.py", line 35, in cmd_help
File "aiogram\methods\base.py", line 84, in emit
File "aiogram\client\bot.py", line 488, in __call__
File "aiogram\client\session\base.py", line 254, in __call__
File "aiogram\client\session\aiohttp.py", line 188, in make_request
aiogram.exceptions.TelegramNetworkError: HTTP Client says - ClientOSError: [Errno 2] Can not write request body for https://api.telegram.org/bottoken:) /sendPhoto