473,651 Members | 3,032 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 3049
On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <cl************ *@gmail.comwrot e:
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.comwrot e:
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.c omwrote:
On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <clodoaldo.pi.. .@gmail.comwrot e:
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.comwrot e:
On Sep 14, 11:45 am, "Guilherme Polo" <ggp...@gmail.c omwrote:
>On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <clodoaldo.pi.. .@gmail.comwrot e:
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
5070
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
4612
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 = False for key, value in kwArgs.items(): if key == 'conversion': conversion = value elif key == 'drop':
14
5246
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 ask_ok(prompt, retries=4, complaint='Yes or no, please!'): while for keyword arguments the tutorial shows: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
1
5632
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 proper handling of keyword arguments. Currently, help(max) gives: max(...) max(sequence) -> value max(a, b, c, ...) -> value With a single sequence argument, return its largest item.
10
1801
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 on all sequences with these semantics: def join(self, seq): T = type(self) result = T()
10
5115
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 not when I use a "normal" function: return len(object)
0
1216
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 reference to `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\cjson.o(.text+0x95):cjson.c: undefined reference to `_imp___Py_NoneStruct' build\temp.win32-2.5\Release\cjson.o(.text+0x122):cjson.c: undefined
3
4244
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 SimpleXMLRPCServer,SimpleXMLRPCRequestHandler # Threaded mix-in class
4
1217
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 = {'a': 1, 'b': 2, 'c': 3}
0
8361
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8278
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8807
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8701
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5615
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1588
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.