cjson 1.0.5 keyword argument

Guilherme Polo ggpolo at gmail.com
Sun Sep 14 17:06:22 CEST 2008


On Sun, Sep 14, 2008 at 11:50 AM, Clodoaldo <clodoaldo.pinto at gmail.com> wrote:
> On Sep 14, 11:45 am, "Guilherme Polo" <ggp... at gmail.com> wrote:
>> On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <clodoaldo.pi... at gmail.com> wrote:
>> > I have installed cjson 1.05 in Fedora 8 (python 2.5.1).
>>
>> > The cjson home page shows a keyword argument "encoding".
>> >http://python.cx.hu/python-cjson/
>>
>> The latest python-cjson on that page is 1.0.3, which accepts keywords
>> for the encode function. python-cjson 1.0.5 no longer accepts.
>>
>> > When i use it i get an error:
>>
>> >>>> cjson.encode('é', encoding='utf8')
>> > Traceback (most recent call last):
>> >  File "<stdin>", line 1, in <module>
>> > TypeError: encode() takes no keyword arguments
>>
>> > What am i missing? There is no mail list for cjson.
>>
>> Try doing cjson.encode('é'.decode('utf-8')) instead.
>
> I had tried decoding first and it worked but my database is utf-8 so i
> don't want that extra step.

I'm not sure about this "extra step" you are talking about. When you
do cjson.encode('é', encoding='utf-8') (supposing you are using
python-cjson 1.0.3) it will actually end up doing the same as
cjson.encode('é'.decode('utf-8'))

>
> BTW i have already found the problem as the other post shows.

Then you didn't install python-cjson 1.0.5, it was probably 1.0.3 like
I said in my other post.

>
> Thanks, Clodoaldo
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list