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
in get_message_history(entity), error "struct.error: required argument is not an integer" #354
Comments
How are you constructing/retrieving the chat? |
|
Just checked version by version and it works in Telethon 0.14 |
Can you somehow print the type of that access hash? Once you construct the request, access that member. |
getting the same struct.error for self.access_hash... all_participants # is a list created by GetParticipantsRequest
print(all_participants) [<telethon.tl.types.User object at 0xXXXXXXXXXXX> etc. >>> for u in range(99):
... get_InputPeer = utils.get_input_peer(all_participants[u]) ## to get user ids and hashes
... get_FullUser = client(GetFullUserRequest(get_InputPeer)) ## to pass to .get_entity
... entities = client.get_entity(get_FullUser)
... usernames_list.append(entities.username) ## populating a list of usernames
...
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "C:\Users\==\AppData\Local\Programs\Python\Python36\telethon\telegram_bare_client.py", line 448, in __call__
result = self._invoke(sender, call_receive, *requests)
File "C:\Users\==\AppData\Local\Programs\Python\Python36\telethon\telegram_bare_client.py", line 467, in _invoke
sender.send(*requests)
File "C:\Users\==\AppData\Local\Programs\Python\Python36\telethon\network\mtproto_sender.py", line 86, in send
self._send_message(message)
File "C:\Users\==\AppData\Local\Programs\Python\Python36\telethon\network\mtproto_sender.py", line 128, in _send_message
+ message.to_bytes()
File "C:\Users\==\AppData\Local\Programs\Python\Python36\telethon\tl\tl_message.py", line 16, in to_bytes
body = GzipPacked.gzip_if_smaller(self.request)
File "C:\Users\==\AppData\Local\Programs\Python\Python36\telethon\tl\gzip_packed.py", line 22, in gzip_if_smaller
data = request.to_bytes()
File "C:\Users\==\AppData\Local\Programs\Python\Python36\telethon\tl\functions\users.py", line 32, in to_bytes
self.id.to_bytes(),
File "C:\Users\==\AppData\Local\Programs\Python\Python36\telethon\tl\types\__init__.py", line 10107, in to_bytes
struct.pack('<q', self.access_hash),
struct.error: required argument is not an integer` printing that entity shows access_hash is None:
|
Okay thanks I'll take a look at why it becomes |
By the way you can just do this: >>> for u in range(99):
... entity = client.get_entity(all_participants[u])
... usernames_list.append(entity.username) |
I have the same problem #350 |
Are you saying calling |
@88ee55 yes but I need enough code to reproduce the issue. |
it returns a user with hash none but it has a username so i don't think it's a deleted account |
Does it show any output if you run |
Search "null" (1105 hits in 1 file) |
So for some reason we're saving |
Thanks! i didn't know i can use client.get_entity on the list members! |
Doing |
oh, i thought no hash isn't a problem... |
I am also running into this - can confirm that there is null in my .session file as well. |
For anyone willing to help, we need to figure out how these nulls make its way there ( if not getattr(p, 'access_hash', 0):
print('(!) log', e, 'with hash', getattr(p, 'access_hash', 0)) Here (line 74): Telethon/telethon/tl/entity_database.py Lines 70 to 79 in ef794bf
|
Am trying now - will send you my logs asap |
These are the channels I've joined. https://t.me/civicplatform
|
@Ericxgao hm… so the access hash comes already as None. Interesting, I wonder from where. |
Is there an interim fix I can use for now? Replacing access hash with a 0 or something? |
You can try |
Hmm, I'm still getting the error with a continue put in like:
|
@Ericxgao make sure this time you put "hash is None", since 0 is valid for normal group chats. Also make sure there were no None's in the database to begin with. |
Works, thank you. Let me know how else I can help. |
Maybe you can log the stack trace when a |
How would I go about logging a stack trace? |
Sorry for the delay - will send the trace in a bit. In the meanwhile, I also noticed that this error occurs every time my session file hits 1,067 KB, not sure if this is relevant or not. |
@Ericxgao probably not related to the size itself but maybe what occurs when such size is reached (like maybe you're invoking certain request). Also wow, 1MB is pretty big, I didn't expect that at all. |
In addition - even with the fix I am still finding null values when doing a search in the .session file. So I'm not entirely sure they're all coming from entity_database? |
Here is the stack, triggered when access hash was None.
|
Cool thanks so it boils down to 4 tracebacks glued together ending in the same line:
Curious it's always a channel. |
Well, I just checked, there are only two kind of channels. |
|
Awesome. |
I am getting that error WARNING:log_pms:required argument is not an integer |
so whats the problem ? |
https://github.com/muhammedfurkan/UniBorg/blob/master/stdplugins/antispam.py https://github.com/muhammedfurkan/UniBorg/blob/master/stdplugins/log_pms.py |
I am getting the same error now but with I have run pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip It works fine in one group but I have created another and it is only in this one where it fails, it is very strange. The bot is an administrator in both. What am I doing wrong?
My code (works in one group and not in another): Telethon code: |
@AlberLC I'm having this same issue currently, glad it's not just me. Checking permissions for newer chats seems to be broken |
im still getting "Request caused struct.error: required argument is not an integer:" errors. how is this fixed in the merge on 24 Jan? |
I also continue with the same problem, I suppose everyone. Every now and then I try it and it keeps crashing but I don't want to put any pressure on Lonami. |
This error should not occur in the v1.24 branch. https://t.me/TelethonUpdates/1276 has more information. |
1.24 branch still has the issue whenever I call permissions = await client.get_permissions(chat, user) where chat is Chat entity and user is just the string for the username. Is there another work around to find out the creator/admin of each chat group? |
After upgrade to Telethon-0.15.2.3 from Telethon-0.11.1, I am calling
get_message_history(entity)
where entity is a chat room, and now receiving and errorstruct.error: required argument is not an integer
. The same call was working correctly before the upgrade.I am looking through the upgrades for the change, but unable to find it.
thank you.
The text was updated successfully, but these errors were encountered: