cjson 1.0.5 keyword argument

Discussion in 'Python' started by Clodoaldo, Sep 14, 2008.

  1. Clodoaldo

    Clodoaldo Guest

    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
     
    Clodoaldo, Sep 14, 2008
    #1
    1. Advertising

  2. On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <> 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.

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




    --
    -- Guilherme H. Polo Goncalves
     
    Guilherme Polo, Sep 14, 2008
    #2
    1. Advertising

  3. Clodoaldo

    Clodoaldo Guest

    On Sep 14, 10:33 am, Clodoaldo <> 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/
    >
    > 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
     
    Clodoaldo, Sep 14, 2008
    #3
  4. Clodoaldo

    Clodoaldo Guest

    On Sep 14, 11:45 am, "Guilherme Polo" <> wrote:
    > On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <> 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.

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

    Thanks, Clodoaldo
     
    Clodoaldo, Sep 14, 2008
    #4
  5. On Sun, Sep 14, 2008 at 11:50 AM, Clodoaldo <> wrote:
    > On Sep 14, 11:45 am, "Guilherme Polo" <> wrote:
    >> On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <> 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
     
    Guilherme Polo, Sep 14, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oktay Safak
    Replies:
    2
    Views:
    1,357
    Oktay Safak
    Aug 2, 2003
  2. Steven Bethard

    keyword argument for min/max

    Steven Bethard, Nov 30, 2004, in forum: Python
    Replies:
    1
    Views:
    321
    Steven Bethard
    Nov 30, 2004
  3. Replies:
    6
    Views:
    486
    Peter Otten
    May 10, 2007
  4. Hamilton, William

    RE: keyword checker - keyword.kwlist

    Hamilton, William, May 10, 2007, in forum: Python
    Replies:
    4
    Views:
    376
  5. Jack
    Replies:
    0
    Views:
    274
Loading...

Share This Page