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

Fix TypeError in method edit_message_media #1131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Neon4o4
Copy link

@Neon4o4 Neon4o4 commented Oct 31, 2022

Fix "TypeError: expected str, bytes or os.PathLike object, not BytesIO" when passing an InputMedia with .media attribute being a BytesIO to method edit_message_media

test case

...

client = Client(**config)
with client:
    doc_io = io.BytesIO(b'aabb123')
    doc_io.name = 'media'
    msg: pyrogram.types.Message = client.send_document(chat_id=test_channel, document=doc_io)
    doc_io.seek(0)
    msg.edit_media(InputMediaDocument(media=doc_io))  # <- got "TypeError: expected str, bytes or os.PathLike object, not BytesIO", fixed in this pr

@TrixiS
Copy link

TrixiS commented Oct 17, 2023

Looks like this PR needs to be merged. The issue is still happening with InputMediaDocument

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

Successfully merging this pull request may close these issues.

2 participants