UnicodeDecodeError'ascii' codec can't decode byte 0xff in position 247: ordinal not in range(128) #154

Closed
opened 2013-03-13 23:00:53 -07:00 by husainihisan · 15 comments
husainihisan commented 2013-03-13 23:00:53 -07:00 (Migrated from github.com)

please help, update status with normal message is fine but with media, i get this error :(

from twython import Twython

twitter = Twython(
twitter_token = '52IKIxxxx',
twitter_secret = 'SvwK4xmxxxx',
oauth_token = '5164xxxxxxx',
oauth_token_secret = 'kVkrHxxxxxx'
)

twitter.updateStatus(status='hello tweet from raspberry pi 1.47am')
twitter.updateStatusWithMedia("/home/pi/teddy.jpg", status='hello!')

image of error http://i.stack.imgur.com/5W1Bq.png

please help, update status with normal message is fine but with media, i get this error :( from twython import Twython twitter = Twython( twitter_token = '52IKIxxxx', twitter_secret = 'SvwK4xmxxxx', oauth_token = '5164xxxxxxx', oauth_token_secret = 'kVkrHxxxxxx' ) twitter.updateStatus(status='hello tweet from raspberry pi 1.47am') twitter.updateStatusWithMedia("/home/pi/teddy.jpg", status='hello!') image of error http://i.stack.imgur.com/5W1Bq.png
grillermo commented 2013-03-20 02:20:03 -07:00 (Migrated from github.com)

Having the exact same problem, pin pointed it to the requests library.
It would be nice to know what requests version does it work.
I got the error with updateProfileBannerImage running requests 1.1.0 on python 2.7.2

Having the exact same problem, pin pointed it to the requests library. It would be nice to know what requests version does it work. I got the error with updateProfileBannerImage running requests 1.1.0 on python 2.7.2
michaelhelmick commented 2013-03-21 07:21:59 -07:00 (Migrated from github.com)

You can follow the new requests issue here: https://github.com/kennethreitz/requests/issues/1252

You can follow the new `requests` issue here: https://github.com/kennethreitz/requests/issues/1252
husainihisan commented 2013-04-01 10:53:09 -07:00 (Migrated from github.com)

does this error fixed? im try update twython and still gettings this error :(

does this error fixed? im try update twython and still gettings this error :(
michaelhelmick commented 2013-04-01 10:59:35 -07:00 (Migrated from github.com)

The changes in requests-oauthlib have JUST been merged in (https://github.com/requests/requests-oauthlib/pull/26#issuecomment-15727300). When a version bump to that library is pushed, I'll push an update to Twython requiring that version of requests-oauthlib

This should be fixed shortly!

The changes in `requests-oauthlib` have JUST been merged in (https://github.com/requests/requests-oauthlib/pull/26#issuecomment-15727300). When a version bump to that library is pushed, I'll push an update to `Twython` requiring that version of `requests-oauthlib` This should be fixed shortly!
michaelhelmick commented 2013-04-08 17:44:42 -07:00 (Migrated from github.com)

I'm closing this and will let everyone know when the updates to requests_oauthlib have been pushed and this has been fixed!

I'm closing this and will let everyone know when the updates to `requests_oauthlib` have been pushed and this has been fixed!
peterbe commented 2013-04-09 13:13:13 -07:00 (Migrated from github.com)

I'm confused about this. @husainihisan's traceback there's no mention of requests_oauthlib
Neither is it in this one: http://pastebin.com/WWNx9TYn

Also, I tried installing the tip of requests-oauthlib but it didn't help.

What did help was to do this:

text = text.encode('utf-8')
twitter.updateStatusWithMedia(
    file_path,
    status=text
)

In other words, I think it's erroring somewhere else. By the way, I'm using requests 1.2.0 as per twython's requirements.

I'm confused about this. @husainihisan's traceback there's no mention of requests_oauthlib Neither is it in this one: http://pastebin.com/WWNx9TYn Also, I tried installing the tip of requests-oauthlib but it didn't help. What did help was to do this: ``` python text = text.encode('utf-8') twitter.updateStatusWithMedia( file_path, status=text ) ``` In other words, I think it's erroring somewhere else. By the way, I'm using requests 1.2.0 as per twython's requirements.
michaelhelmick commented 2013-04-09 13:29:04 -07:00 (Migrated from github.com)

@peterbe Please see kennethreitz/requests#1252 and requests/requests-oauthlib/pull/26

@peterbe Please see kennethreitz/requests#1252 and requests/requests-oauthlib/pull/26
mgrouchy commented 2013-04-25 11:49:54 -07:00 (Migrated from github.com)

@michaelhelmick so this is still an ongoing issue? I tried the same thing @peterbe did, but alas, Im having less success then he did.

@michaelhelmick so this is still an ongoing issue? I tried the same thing @peterbe did, but alas, Im having less success then he did.
michaelhelmick commented 2013-04-25 11:56:18 -07:00 (Migrated from github.com)

@mgrouchy Yes, I actually just talked to @kennethreitz yesterday about a possible new release of requests_oauthlib since there wasn't one with the issue was fixed.

Uploading an image works currently in master branch of https://github.com/requests/requests-oauthlib, so.. for now if you can; clone the repo and install it to your site-packages for the time being. If you can't, hopefully we'll see a new version on PyPi soon :)

@mgrouchy Yes, I actually just talked to @kennethreitz yesterday about a possible new release of `requests_oauthlib` since there wasn't one with the issue was fixed. Uploading an image works currently in `master` branch of https://github.com/requests/requests-oauthlib, so.. for now if you can; clone the repo and install it to your site-packages for the time being. If you can't, hopefully we'll see a new version on PyPi soon :)
mgrouchy commented 2013-04-25 12:05:20 -07:00 (Migrated from github.com)

@michaelhelmick thats so strange, because I installed like so:
pip install -e git+https://github.com/requests/requests-oauthlib.git#egg=requests_oauthlib
and still no joy. That being said, my stack trace still looks like @husainihisan's.

https://gist.github.com/mgrouchy/5462228

Maybe something got messed up with the installation. I will investigate and see if I can dig anything else up.

@michaelhelmick thats so strange, because I installed like so: ` pip install -e git+https://github.com/requests/requests-oauthlib.git#egg=requests_oauthlib ` and still no joy. That being said, my stack trace still looks like @husainihisan's. https://gist.github.com/mgrouchy/5462228 Maybe something got messed up with the installation. I will investigate and see if I can dig anything else up.
michaelhelmick commented 2013-04-25 13:44:10 -07:00 (Migrated from github.com)

Nope, you're right...
Mind Blown

Nope, you're right... ![Mind Blown](http://24.media.tumblr.com/db649f4441940d7fcbbc2bd5d6646bc1/tumblr_mlj0syTLbP1rf1e3ro1_250.gif)
michaelhelmick commented 2013-04-25 13:46:05 -07:00 (Migrated from github.com)

Haha, sorry. I just tried installing every version of requests_oauthlib since this commit:
156543bb72

Even that commit doesn't work anymore.
I've tried requests 1.1.0 and 1.2.0..... it literally just worked the other day. My brain hurts. Let me get back to you on this later today (in like an hour) or tomorrow and figure out what's going on. I'm literally just dumbfounded right now. haha

Haha, sorry. I just tried installing every version of `requests_oauthlib` since this commit: https://github.com/requests/requests-oauthlib/commit/156543bb7245944a23ae38dc2b6abad2c5848a1f Even that commit doesn't work anymore. I've tried `requests` 1.1.0 and 1.2.0..... it literally just worked the other day. My brain hurts. Let me get back to you on this later today (in like an hour) or tomorrow and figure out what's going on. I'm literally just dumbfounded right now. haha
mgrouchy commented 2013-04-25 17:46:15 -07:00 (Migrated from github.com)

@michaelhelmick haha, okay. Thanks! Much appreciated!

@michaelhelmick haha, okay. Thanks! Much appreciated!
michaelhelmick commented 2013-04-26 15:25:15 -07:00 (Migrated from github.com)

@mgrouchy Alright, I was right: it is fixed at this commit 156543bb72 but breaks on the commit after. I'm talking to the guys in requests-oauthlib in an issue about it now. I'll keep you updated, or you can follow https://github.com/requests/requests-oauthlib/issues/36

@mgrouchy Alright, I was right: it is fixed at this commit https://github.com/requests/requests-oauthlib/commit/156543bb7245944a23ae38dc2b6abad2c5848a1f but breaks on the commit after. I'm talking to the guys in requests-oauthlib in an issue about it now. I'll keep you updated, or you can follow https://github.com/requests/requests-oauthlib/issues/36
michaelhelmick commented 2013-05-04 12:18:22 -07:00 (Migrated from github.com)

@mgrouchy @peterbe @husainihisan @grillermo requests-oauthlib 0.3.1 fixes this. I updated setup.py to require that version only on new installs of Twython!

You can either:
pip install -I requests-oauthlib

or install Twython 2.9.0
pip install -I twython (warning: 2.9.0 offers fixed streaming. So if you are using Twython's streaming API, be sure to upgrade to use the new TwythonStreamer)

@mgrouchy @peterbe @husainihisan @grillermo `requests-oauthlib` 0.3.1 fixes this. I updated `setup.py` to require that version _only_ on new installs of `Twython`! You can either: `pip install -I requests-oauthlib` or install `Twython` 2.9.0 `pip install -I twython` (**warning:** 2.9.0 offers fixed streaming. So if you are using Twython's streaming API, be sure to upgrade to use the new `TwythonStreamer`)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#154
No description provided.