I had installed the python package named requests. (pip install -i http://pip.kennethreitz.com/simple requests)
First, I tried using the common user ($) but didn't worked, so, i tried the root one (#) and worked.
The problem was in the use. When I try a simple code like
$python
>>>import requests
>>>r = requests.get('http://www.google.com')
>>>r.content
I got a incridble annoying result (see this pastebin link.)
But using root
$sudo python
>>>import requests
>>>r = requests.get('http://www.google.com')
>>>r.content
I got the correct and reasonable result: pastebin.
How can I fix this? This happens with urllib.urlencode too. (Maybe installed using sudo easy_install, but I don't remember anymore).
I tried chmod -R 777 in /usr/local/lib/python2.6/dist-packages and /usr/local/lib/python2.6/site-packages but still with the same problem.
I really think the problem is with python packages because this codes are extremly simply.
System details:
Python 2.6.5
Ubuntu LTS 10.04.4
requests package 0.7.5
It looks like your problems have to do with unicode. Try r.content.decode('utf-8')
.