Skip to content


Subversion checkout URL

You can clone with
Download ZIP


argument 'safe' is not recognized by urlencode from urllib with python 2.7 #65

traut opened this Issue · 5 comments

4 participants


I was trying to use the latest version from the trunk and I've got this exception:

 File "/Users/andrew/appwiser/appwiser/p27/src/twitter/twitter/", line 159, in call
   arg_data = self.auth.encode_params(uriBase, method, kwargs)
 File "/Users/andrew/appwiser/appwiser/p27/src/twitter/twitter/", line 105, in encode_params
   enc_params = urlencode_noplus(sorted(params.items()))
 File "/Users/andrew/appwiser/appwiser/p27/src/twitter/twitter/", line 132, in urlencode_noplus
   return urlencode(query, safe='~').replace("+", "%20")
TypeError: urlencode() got an unexpected keyword argument 'safe'

I'm using python 2.7 and twitter/ imports urlencode from urllib. This urlencode does not support 'safe' argument


I had the same error today and i solved it by removing the setup-tools module and reinstalling it
Instead of doing apt-get setup-tools download from source and install it
I used 0.6c11
Hope that's a fix for you as well (I actually registered just to give you an answer)


@giorkosman thank you, I'm going to try that


i am also getting the same error,i am using a windows machine, what should i do ?


How did you install the module ?
On my windows machine i use Active State Python which comes with an installation module named easy_install
So in cmd type easy_install twitter. Try this and tell me (You can install easy install with any python you have)


Hi there! We're gonna get you all set up to use sampleforminging.

Traceback (most recent call last):
File "C:\py.PY", line 39, in
File "C:\py.PY", line 17, in oauth_login
File "build\\egg\twitter\", line 35, in oauth_dance
File "build\\egg\twitter\", line 159, in call
arg_data = self.auth.encode_params(uriBase, method, kwargs)
File "build\\egg\twitter\", line 105, in encode_params
enc_params = urlencode_noplus(sorted(params.items()))
File "build\\egg\twitter\", line 132, in urlencode_noplus
return urlencode(query, safe='~').replace("+", "%20")
TypeError: urlencode() got an unexpected keyword argument 'safe'

i get the same error...

My Code :

@ptwobrussell ptwobrussell referenced this issue from a commit in ptwobrussell/twitter
@ptwobrussell ptwobrussell Fixes Issue #65 (argument 'safe' is not recognized by urlencode from …
…urllib with python 2.7)
@sixohsix sixohsix closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.