[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pyamf-tickets
Subject:    Re: [pyamf-tickets] #842: TypeError: list indices must be integers,
From:       PyAMF list for bug and patch messages <tickets () pyamf ! org>
Date:       2011-07-18 16:46:18
Message-ID: 052.066f227c1f77f57556fc780b78187eae () pyamf ! org
[Download RAW message or body]

#842: TypeError: list indices must be integers, not str : ref ticket #716
------------------------------+-------------------
         Reporter:  ckhoo     |      Owner:  nick
             Type:  defect    |     Status:  new
         Priority:  major     |  Milestone:  0.7
        Component:  Remoting  |    Version:  0.6.1
       Resolution:            |   Keywords:
           Author:            |     Branch:
Fixed in revision:            |
------------------------------+-------------------

Old description:

> Encountered the same error mentioned in ticket #716.
>
> TypeError: list indices must be integers, not str
> pyamf/util/__init__.py,  line: 89
>
> The obj type, in my case, is a list and not a dict and thus, causing the
> failure.
>

> To allow myself to continue with what I am doing, I changed line 89 from
>
> {{{
> [o(obj, k, v) for k, v in attrs.iteritems()]
> }}}
>

> to:
>
> {{{
> if isinstance(obj, list):
>     [obj.append(v) for k, v in attrs.iteritems()]
> else:
>     [o(obj, k, v) for k, v in attrs.iteritems()]
> }}}

New description:

 Encountered the same error mentioned in ticket #716.

 {{{
 TypeError: list indices must be integers, not str
 pyamf/util/__init__.py,  line: 89
 }}}

 The obj type, in my case, is a list and not a dict and thus, causing the
 failure.


 To allow myself to continue with what I am doing, I changed line 89 from

 {{{
 [o(obj, k, v) for k, v in attrs.iteritems()]
 }}}


 to:

 {{{
 if isinstance(obj, list):
     [obj.append(v) for k, v in attrs.iteritems()]
 else:
     [o(obj, k, v) for k, v in attrs.iteritems()]
 }}}

--

Comment (by thijs):

 To get a better view of the request/response string, assign it to a Python
 var and `pprint` it ;)

 {{{
 #!python
 import pprint
 null = None
 t = "amf request here from previous comment here..."
 print pprint.pprint(t)
 }}}

-- 
PyAMF - Ticket URL: <http://dev.pyamf.org/ticket/842#comment:3>
_______________________________________________
PyAMF tickets mailing list - tickets@pyamf.org
http://lists.pyamf.org/mailman/listinfo/tickets
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic