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

"TweepError: media type unrecognized" when trying to upload WebP file #1542

Closed
ghost opened this issue Feb 28, 2021 · 3 comments
Closed

"TweepError: media type unrecognized" when trying to upload WebP file #1542

ghost opened this issue Feb 28, 2021 · 3 comments
Labels
Invalid This is not valid No Reproduction This is not reproducible

Comments

@ghost
Copy link

ghost commented Feb 28, 2021

Hello,

I'm encountering the above error trying to upload WebP file with this simple code : (Work just fine with a jpeg file)

>>> with open('output.webp', 'rb') as f:
...     api.media_upload('output.webp', file=f)

The full traceback is below :

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/.../lib/python3.8/site-packages/tweepy/api.py", line 242, in media_upload
    return bind_api(
  File "/.../lib/python3.8/site-packages/tweepy/binder.py", line 253, in _call
    return method.execute()
  File "/.../lib/python3.8/site-packages/tweepy/binder.py", line 234, in execute
    raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: media type unrecognized.

I've already search through other issues, the best that i've found is that WebP file are now supported by Tweepy since December 2020.
This might be important, but the webp file is an output of the pillow library (fork from PIL)

The install version of Tweepy is 3.10.0

Thank you for your help.

Best regards.

@Harmon758
Copy link
Member

This is an error from Twitter's API rather than Tweepy, and I'm unable to reproduce this with https://www.gstatic.com/webp/gallery/1.webp (from https://developers.google.com/speed/webp/gallery1).
Are you sure the issue isn't with the image itself?

@Harmon758 Harmon758 added Need Follow-Up This needs to be followed up on to be actionable No Reproduction This is not reproducible labels Mar 1, 2021
@ghost
Copy link
Author

ghost commented Mar 1, 2021

I'm trying ASAP with your file. Thanks for your response.

@ghost
Copy link
Author

ghost commented Mar 6, 2021

It work like a charm with some random webp file. The problem is probably the way pillow output webp images. Sorry for bothering you ! And thanks for your response.

@ghost ghost closed this as completed Mar 6, 2021
@Harmon758 Harmon758 added Invalid This is not valid and removed Need Follow-Up This needs to be followed up on to be actionable labels Mar 6, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid This is not valid No Reproduction This is not reproducible
Projects
None yet
Development

No branches or pull requests

1 participant