473,503 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cjson 1.0.5 keyword argument

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

Regards, Clodoaldo
Sep 14 '08 #1
4 3032
On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <cl*************@gmail.comwrote:
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.
>
Regards, Clodoaldo
--
http://mail.python.org/mailman/listinfo/python-list


--
-- Guilherme H. Polo Goncalves
Sep 14 '08 #2
On Sep 14, 10:33 am, Clodoaldo <clodoaldo.pi...@gmail.comwrote:
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:
>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.
The problem is the package from Fedora 8. When i install from source
it works.

Regards, Clodoaldo
Sep 14 '08 #3
On Sep 14, 11:45 am, "Guilherme Polo" <ggp...@gmail.comwrote:
On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <clodoaldo.pi...@gmail.comwrote:
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.

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

Thanks, Clodoaldo

Sep 14 '08 #4
On Sun, Sep 14, 2008 at 11:50 AM, Clodoaldo <cl*************@gmail.comwrote:
On Sep 14, 11:45 am, "Guilherme Polo" <ggp...@gmail.comwrote:
>On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <clodoaldo.pi...@gmail.comwrote:
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
Sep 14 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5062
by: Oktay Safak | last post by:
Hi, Is there an equivalent keyword argument syntax for these cases: d1 = {1:"one"} d2 = {"1":"one"} these don't work, of course:
6
4594
by: Roy Smith | last post by:
I've got a function that takes a couple of optional keyword arguments. I want to check to make sure I didn't get passed an argument I didn't expect. Right now I'm doing: conversion = None drop...
14
5197
by: Edward Diener | last post by:
In the tutorial on functions there are sections on default arguments and keyword arguments, yet I don't see the syntactic difference between them. For default arguments the tutorial shows: def...
1
5606
by: Steven Bethard | last post by:
So I've been playing around with trying to add a keyword argument to min and max that works similarly to the one for sorted. It wasn't too hard actually, but it does raise a few questions about...
10
1789
by: David Murmann | last post by:
Hi all! I could not find out whether this has been proposed before (there are too many discussion on join as a sequence method with different semantics). So, i propose a generalized .join method...
10
5087
by: Armando Serrano Lombillo | last post by:
Why does Python give an error when I try to do this: Traceback (most recent call last): File "<pyshell#40>", line 1, in <module> len(object=) TypeError: len() takes no keyword arguments but...
0
1211
by: Jack | last post by:
Since I don't have VS2003, I'm trying to build cjson with MingW and Cygwin but I'm getting lots of errors like these: build\temp.win32-2.5\Release\cjson.o(.text+0x8e):cjson.c: undefined...
3
4226
by: Sean DiZazzo | last post by:
Why is the following not working? Is there any way to get keyword arguments working with exposed XMLRPC functions? ~~~~~~~~~~~~~~~~ server.py import SocketServer from SimpleXMLRPCServer import...
4
1212
by: kj | last post by:
I'm running into a strange seg fault with the module cjson. The strange part is that it does not occur when I run the code under Emacs' Pydb. Here's an example: import sys, cjson d1 =...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.