cjson 1.0.5 keyword argument

C

Clodoaldo

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/

When i use it i get an error:
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.

Regards, Clodoaldo
 
G

Guilherme Polo

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:

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.
 
C

Clodoaldo

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/

When i use it i get an error:


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.

The problem is the package from Fedora 8. When i install from source
it works.

Regards, Clodoaldo
 
C

Clodoaldo

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.



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.

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

Thanks, Clodoaldo
 
G

Guilherme Polo

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top