AttributeError: 'unicode' object has no attribute 'keys'

1,578 views
Skip to first unread message

nnc

unread,
Mar 24, 2015, 2:03:14 PM3/24/15
to robotframe...@googlegroups.com
1. i have a testdata.py with below

owner_account_detail = {'123': {'password':'xxx', 'value':['480186','67854']},
                        '456': {'password':'xxx', 'value':['877712']}}


2. I have a python library (nesteddictex.py) where i have funtions that will return len of the dictitionary 

    def get_dictlen(self,my_dict):
        sortKeys = list(my_dict.keys())
        return int(my_dict.__len__())

3. i have test1.txt is my robot txt file which I run using pybot test1.txt on command line

*** Settings ***
Documentation    nesteddictex Test suite
Library    nesteddictex

*** Variables ***


*** Test Cases ***
    ${r} =    get dictlen  arg=Testdata.owner_account_detail
    log to console  status1: ${r}

*** Keywords ***
    Numbers Should Be Equal    value    value


when I run the above testcase it get AttributeError: 'unicode' object has no attribute 'keys'. please anyone can help me with one ?

nnc

unread,
Mar 24, 2015, 2:53:26 PM3/24/15
to robotframe...@googlegroups.com
nm resolved the issue :

Rochak Bhalla

unread,
May 29, 2017, 12:33:28 PM5/29/17
to robotframework-users
Hi nmc,

I am too getting similar type of error : FAIL : AttributeError: 'unicode' object has no attribute 'get'

What I am doing is somewhere similar to the above you have done, although i am using get method.

Can you please help me, I am confused how to change the passed unicode argument into the dictionary.

Thanks
Rochak  
Reply all
Reply to author
Forward
0 new messages