Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct.error: 'i' format requires -2147483648 <= number <= 2147483647 #2

Open
Dhamareshwarakumar opened this issue Apr 30, 2024 · 4 comments

Comments

@Dhamareshwarakumar
Copy link

Dhamareshwarakumar commented Apr 30, 2024

While running the script I am getting the following error (followed instructiond as per README)
struct.error: 'i' format requires -2147483648 <= number <= 2147483647
what might be the issue causing this?

Detailed error

Telegram client initialization...Request caused struct.error: 'i' format requires -2147483648 <= number <= 2147483647: InvokeWithLayerRequest(layer=173, query=InitConnectionRequest(api_id=6981635625, device_model='arm64', system_version='23.4.0', app_version='1.34.0', system_lang_code='en', lang_pack='', lang_code='en', query=GetConfigRequest(), proxy=None, params=None))
Traceback (most recent call last):
File "/path/CCTV/start.py", line 108, in <module>
with TelegramClient(telegram_name, telegram_api_id, telegram_api_hash) as client:
@IvanGlinkin
Copy link
Owner

IvanGlinkin commented May 1, 2024

Your api_id is 6981635625 which should be in range between -2147483648 and 2147483647
Please check if you copy/pasted Telegram API ID and Hash correctly

@alebedev80
Copy link

alebedev80 commented May 9, 2024

@IvanGlinkin Why this issue was closed? user id doesn't fit to int type. Please fix

@IvanGlinkin IvanGlinkin reopened this May 9, 2024
@IvanGlinkin
Copy link
Owner

@IvanGlinkin Why this issue was closed? user id doesn't fit to int type. Please fix

you mean to implement the feature to check what user is inputting? Sorry, did not get the question.

@paracosm17
Copy link
Contributor

@IvanGlinkin Why this issue was closed? user id doesn't fit to int type. Please fix

you mean to implement the feature to check what user is inputting? Sorry, did not get the question.

I think he means that the user IDs in telegram switched from the int32 type to the int64 type in 2021. And the check -2147483648 <= number <= 2147483647 corresponds to the int32 type, while int64 is already 9223372036854775807.

But the exception is caused by the Telethon library and it swears not at the user's ID, but at the API ID. I'm not sure exactly what type the API ID should be int32 or int64.

Most likely, the API ID should not exceed 32 bits and the person simply entered their API ID incorrectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants