[BangPypers] Python-yql error

JAGANADH G jaganadhg at gmail.com
Sat Oct 16 11:03:05 CEST 2010


On Sat, Oct 16, 2010 at 2:29 PM, JAGANADH G <jaganadhg at gmail.com> wrote:

>
>
> On Thu, Oct 14, 2010 at 7:03 PM, Anand Balachandran Pillai <
> abpillai at gmail.com> wrote:
>
>> Runs fine for me.
>>
>> Python 2.7 (r27:82500, Oct  8 2010, 14:07:56)
>> [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import yql
>> >>> y = yql.Public()
>> >>> y.execute('select * from flickr.photos.search where text="panda" limit
>> 3')
>> <yql.YQLObj object at 0xb7b50f8c>
>> >>>
>>
>> Btw, the traceback seems to indicate you have installed httplib2
>> on top of the standard httplib which comes with Python.
>>
>>
>>   1. /usr/lib/python2.6/site-packages/httplib2/__init__.pyc in
>> connect(self
>>   )
>>   2.     734             sock = socket.socket(socket.AF_INET, socket.
>>   SOCK_STREAM)
>>   3.     735         if self.timeout is not None:
>>   4. --> 736             sock.settimeout(self.timeout)
>>   5.     737         sock.connect((self.host, self.port))
>>   6.     738         ssl = socket.ssl(sock, self.key_file, self.cert_file)
>>
>> Try removing httplib2 and see if it works.
>>
>>
> I removed the httplib2. Now I am getting this error
> In [1]: import yql
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call last)
>
> /home/jaganadhg/Desktop/music/<ipython console> in <module>()
>
> /usr/lib/python2.6/site-packages/yql-0.4-py2.6.egg/yql/__init__.py in
> <module>()
>      25 from urlparse import urlparse
>      26 from urllib import urlencode
> ---> 27 from httplib2 import Http
>      28
>      29 from yql.utils import get_http_method
>
> ImportError: No module named httplib2
>
> In [2]:
>
>

After removing http lib once again I installed python-yql . Then I tried the
same example. Any how the error changed to
In [4]: y.execute('select * from flickr.photos.search where text="panda"
limit=3')
---------------------------------------------------------------------------
YQLError                                  Traceback (most recent call last)

/home/jaganadhg/Desktop/music/<ipython console> in <module>()

/usr/lib/python2.6/site-packages/yql-0.4-py2.6.egg/yql/__init__.pyc in
execute(self, query, params, **kwargs)
    223             return YQLObj(json.loads(content))
    224         else:
--> 225             raise YQLError, (resp, content)
    226
    227

YQLError: ({'status': '400', 'transfer-encoding': 'chunked', 'age': '0',
'vary': 'Accept-Encoding', 'server': 'YTS/1.17.21', 'connection':
'keep-alive', 'cache-control': 'private', 'date': 'Sat, 16 Oct 2010 09:01:12
GMT', 'p3p': 'policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR
CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi
PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"',
'content-type': 'application/json;charset=utf-8',
'access-control-allow-origin': '*'},
'{"error":{"lang":"en-US","description":"Syntax error(s) [line 1:59
expecting limit got \'=\']"}}')



-- 
**********************************
JAGANADH G
http://jaganadhg.freeflux.net/blog


More information about the BangPypers mailing list