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

can't print story #75

Open
3 tasks done
gmankab opened this issue Jun 15, 2024 · 0 comments
Open
3 tasks done

can't print story #75

gmankab opened this issue Jun 15, 2024 · 0 comments

Comments

@gmankab
Copy link

gmankab commented Jun 15, 2024

Checklist

  • I am sure the error is coming from Pyrofork's code and not elsewhere
  • I have searched in the issue tracker for similar bug reports, including closed ones
  • I ran pip3 install -U git+https://github.com/Mayuri-Chan/pyrofork and reproduced the issue using the latest development version

Description

see code example

Steps to reproduce

see code example

Code example

import pyrogram.client
import pyrogram.types
import asyncio


async def main():
    client = pyrogram.client.Client(
        name='tg_bot',
    )
    await client.start()
    msg = await client.get_messages(
        chat_id='@autotests_source',
        message_ids=121,
    )
    assert isinstance(msg, pyrogram.types.Message)
    print(msg.story.__dict__) # works
    print(msg.story) # throws error


asyncio.run(main())

Logs

.venv/bin/python test.py
Traceback (most recent call last):
  File "/var/home/hmk/proj/test/test.py", line 20, in <module>
    asyncio.run(main())
  File "/usr/lib64/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/var/home/hmk/proj/test/test.py", line 17, in main
    print(msg.story)
  File "/var/home/hmk/proj/test/.venv/lib64/python3.12/site-packages/pyrogram/types/object.py", line 83, in __str__
    return dumps(self, indent=4, default=Object.default, ensure_ascii=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/usr/lib64/python3.12/json/encoder.py", line 202, in encode
    chunks = list(chunks)
             ^^^^^^^^^^^^
  File "/usr/lib64/python3.12/json/encoder.py", line 440, in _iterencode
    yield from _iterencode(o, _current_indent_level)
  File "/usr/lib64/python3.12/json/encoder.py", line 432, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/usr/lib64/python3.12/json/encoder.py", line 406, in _iterencode_dict
    yield from chunks
  File "/usr/lib64/python3.12/json/encoder.py", line 439, in _iterencode
    o = _default(o)
        ^^^^^^^^^^^
  File "/var/home/hmk/proj/test/.venv/lib64/python3.12/site-packages/pyrogram/types/object.py", line 72, in default
    obj.__dict__,
    ^^^^^^^^^^^^
AttributeError: 'Chats' object has no attribute '__dict__'. Did you mean: '__dir__'?
wulan17 added a commit that referenced this issue Jun 15, 2024
eyMarv pushed a commit to eyMarv/pyroblack that referenced this issue Jun 17, 2024
Signed-off-by: wulan17 <[email protected]>

(cherry picked from commit f1bea2c)
Signed-off-by: eyMarv <[email protected]>
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

1 participant