pylakey/aiotdlib

0.18.0 some modules are missing

midfinup1 opened this issue · 15 comments

Traceback (most recent call last):
File "\Telegram_Bot\Bot.py", line 3, in
from aiotdlib.api.types import ReplyMarkupInlineKeyboard, InlineKeyboardButton
File "\lib\site-packages\aiotdlib_init_.py", line 3, in
from .client import (
File "\lib\site-packages\aiotdlib\client.py", line 31, in
from .api import (
File "\lib\site-packages\aiotdlib\api_init_.py", line 7, in
from .api import API
File "\venv\lib\site-packages\aiotdlib\api\api.py", line 10, in
from .functions import *
File "\lib\site-packages\aiotdlib\api\functions_init_.py", line 7, in
from .accept_call import AcceptCall
File "\lib\site-packages\aiotdlib\api\functions\accept_call.py", line 11, in
from ..types import CallProtocol
File "\lib\site-packages\aiotdlib\api\types_init_.py", line 15, in
from .attachment_menu_bot import AttachmentMenuBot
ModuleNotFoundError: No module named 'aiotdlib.api.types.attachment_menu_bot'

How can I fix this?

Could you provide a minimal code example?

Sure

`client_path = 'C:\Users\midfinup\PycharmProjects\SpotiFind\td\tdlib\bin\tdjson.dll'
bot = Client(bot_token=token, api_id=api_id, api_hash=api_hash, library_path=client_path)

@bot.bot_command_handler(command='start')
def send_welcome(message_):
message = message_
keyboard = ReplyMarkupInlineKeyboard()
keyboard.row_width = 2
keyboard.add(InlineKeyboardButton(text="Старт", callback_data="/start"))
keyboard.add(InlineKeyboardButton(text="Информация", callback_data="/info"),
InlineKeyboardButton(text="Справка", callback_data="/help"))
bot.send_sticker(message.chat.id, 'CAACAgIAAxkBAAEBd-9g0KBzF4nMZr8kNTyGnaqW7vKg2gAC8wMAAlrmjhFXAAESHYTiOwkfBA')
bot.send_message(message.chat.id, f'Бот готов к работе 😊\n\t',
reply_markup=keyboard)

bot.run()`

Hello!

I have the same problem with demo example from here: https://github.com/pylakey/aiotdlib#base-example

python 3.10.4
poetry 1.1.13
tdlib 1.8.0
aiotdlib 0.18.0

UPD:
Thw same result with tdlib 1.8.3 from pylakey/td@f295ef3

Okay, i found the problem root:
Generated python code in pypi package is broken

IDE founds some errors in file:
aiotdlib/aiotdlib/api/functions/__init__.py

I clone repo, stand on tag 0.18.0 and run poetry run aiotdlib_generator
It makes too many changes but IDE didnt found problem in generated code
Then I build package with poetry build command, install it and now demo example works great!

@pylakey
Could you rebuild pypi package correctly?
Thank you in advance!

Hi. jesnguard.
I'm facing the same problem as you, and I think you've found a solution.
But I can't apply the solution you wrote down.
Can you tell me how to do it in detail?

Hi. jesnguard. I'm facing the same problem as you, and I think you've found a solution. But I can't apply the solution you wrote down. Can you tell me how to do it in detail?

Hello!
To work with aiotdlib you need to install poetry
https://python-poetry.org/docs/
Poetry also is available as deb/rpm package in most linux distributions

Now you can build your own package

  1. Clone this repo
git clone https://github.com/pylakey/aiotdlib.git
cd aiotdlib
git checkout tags/0.18.0
  1. Install dependencies
poetry install
  1. Generate code
poetry run aiotdlib_generator
  1. Build package
poetry build

Done
You can find fixed packages in dist/ directory

Hi. jesnguard. I'm facing the same problem as you, and I think you've found a solution. But I can't apply the solution you wrote down. Can you tell me how to do it in detail?

Hello! To work with aiotdlib you need to install poetry https://python-poetry.org/docs/ Poetry also is available as deb/rpm package in most linux distributions

Now you can build your own package

  1. Clone this repo
git clone https://github.com/pylakey/aiotdlib.git
cd aiotdlib
git checkout tags/0.18.0
  1. Install dependencies
poetry install
  1. Generate code
poetry run aiotdlib_generator
  1. Build package
poetry build

Done You can find fixed packages in dist/ directory

Thank you for your quick response.
However, I am a Windows user.
Do you think the aiotdlib package is suitable for use in Windows?
If the method used in Windows is the same, I will try it.
In Windows, I tried to install Poetry through Pip and build there, but it didn't work well, but I will try again.

Hi. jesnguard. I'm facing the same problem as you, and I think you've found a solution. But I can't apply the solution you wrote down. Can you tell me how to do it in detail?

Hello! To work with aiotdlib you need to install poetry https://python-poetry.org/docs/ Poetry also is available as deb/rpm package in most linux distributions
Now you can build your own package

  1. Clone this repo
git clone https://github.com/pylakey/aiotdlib.git
cd aiotdlib
git checkout tags/0.18.0
  1. Install dependencies
poetry install
  1. Generate code
poetry run aiotdlib_generator
  1. Build package
poetry build

Done You can find fixed packages in dist/ directory

Thank you for your quick response. However, I am a Windows user. Do you think the aiotdlib package is suitable for use in Windows? If the method used in Windows is the same, I will try it. In Windows, I tried to install Poetry through Pip and build there, but it didn't work well, but I will try again.

To be honest I have never tried doing this on windows, but most likely the package will be built
However, the problem is that the package does not contain binary dll of tdlib for windows, so you need to build it manually by commit pylakey/td@f295ef3
Build instruction is available here: https://tdlib.github.io/td/build.html

Also, you can try Windows Subsystem for Linux (WSL) if you know how it works

poetry build

SUPER Thanks to
I solved problem.

Hi. jesnguard. I'm facing the same problem as you, and I think you've found a solution. But I can't apply the solution you wrote down. Can you tell me how to do it in detail?

Hello! To work with aiotdlib you need to install poetry https://python-poetry.org/docs/ Poetry also is available as deb/rpm package in most linux distributions
Now you can build your own package

  1. Clone this repo
git clone https://github.com/pylakey/aiotdlib.git
cd aiotdlib
git checkout tags/0.18.0
  1. Install dependencies
poetry install
  1. Generate code
poetry run aiotdlib_generator
  1. Build package
poetry build

Done You can find fixed packages in dist/ directory

Thank you for your quick response. However, I am a Windows user. Do you think the aiotdlib package is suitable for use in Windows? If the method used in Windows is the same, I will try it. In Windows, I tried to install Poetry through Pip and build there, but it didn't work well, but I will try again.

To be honest I have never tried doing this on windows, but most likely the package will be built However, the problem is that the package does not contain binary dll of tdlib for windows, so you need to build it manually by commit pylakey/td@f295ef3 Build instruction is available here: https://tdlib.github.io/td/build.html

Also, you can try Windows Subsystem for Linux (WSL) if you know how it works

Can I ask you one more question?
api_id=API_ID,
api_hash=API_HASH,
phone_number=PHONE_NUMBER
Is there any other way than this way?

I want to use only api_id and hash.
I'd appreciate it if you could let me know if you knew.

@pylakey

Could you rebuild pypi package correctly?

Thank you in advance!

Yes, sure, will be fixed in 0.18.1

Can I ask you one more question?

    api_id=API_ID,

    api_hash=API_HASH,

    phone_number=PHONE_NUMBER

Is there any other way than this way?

I want to use only api_id and hash.

I'd appreciate it if you could let me know if you knew.

No, you must be authorized using either phone_number (for users accounts) or bot_token (for bots accounts)

@pylakey, hello! When will release 0.18.1 version with the fix?

In a few days 0.19.0 will be released with up to date tdlib

Fixed in 0.19.0