reg: AttributeError: 'unicode' object has no attribute 'append'

2,860 views
Skip to first unread message

Maya.R

unread,
Nov 5, 2013, 1:33:55 AM11/5/13
to robotframe...@googlegroups.com
Hi! im having an issue!! .... pls do help me out..

the below is what i have done...


:FOR    ${indexdata}    IN RANGE    1    10
    \    ${VALEXCEL}=    GetCellData New        ${sheet.name}    2    ${indexdata}    #@{sheet.clmn.number}[${indexdata}]   
    \    ${val}=    Convert To List    ${VALEXCEL}               
    \    Append To List    ${excelvalue}    ${val}

RESULT:

test1                                                                 | FAIL |
AttributeError: 'unicode' object has no attribute 'append'

Laurent Bristiel

unread,
Nov 5, 2013, 2:43:24 AM11/5/13
to robotframe...@googlegroups.com
Hello,

Looks like ${excelvalue} is a unicode string and not a list.
could you show us the portion of code where it gets initialized?

Laurent

Maya.R

unread,
Nov 5, 2013, 8:13:48 AM11/5/13
to robotframe...@googlegroups.com
Hi thnq for quick reply!!! .....

Again i have met with same issue!!!
 i have given ${excelvalue} as,

*** Variable ***
${excelvalue}=    Create List

Laurent Bristiel

unread,
Nov 5, 2013, 10:03:32 AM11/5/13
to robotframe...@googlegroups.com
You can not call keywords in the variable section.
You just can set a value to a variable
If you want to assign the returned value of a keyword to a variable, you have to do it within a test case.
So you have 2 ways to solve your issue

1) with variable section
*** Variable ***
@{excelvalue}

*** test cases ***

:FOR    ${indexdata}    IN RANGE    1    10
    \    ${VALEXCEL}=    GetCellData New        ${sheet.name}    2    ${indexdata}    #@{sheet.clmn.number}[${
indexdata}]   
    \    ${val}=    Convert To List    ${VALEXCEL}               
    \    Append To List    ${excelvalue}    ${val}

2) without variable section
*** test cases ***

${excelvalue}=    Create List
:FOR    ${indexdata}    IN RANGE    1    10
    \    ${VALEXCEL}=    GetCellData New        ${sheet.name}    2    ${indexdata}    #@{sheet.clmn.number}[${
indexdata}]   
    \    ${val}=    Convert To List    ${VALEXCEL}               
    \    Append To List    ${excelvalue}    ${val}

HTH,
Laurent

Maya.R

unread,
Nov 6, 2013, 12:31:14 AM11/6/13
to robotframe...@googlegroups.com
Hi... sry!! kk i have changed ..... in **keyword** i have given  as follows
*** keyword ***
@{excelvalue}= Create list
:FOR    ${indexdata}    IN RANGE    1    10
    \    ${VALEXCEL}=    GetCellData New        ${sheet.name}    2    ${indexdata}    #@{sheet.clmn.number}[${
indexdata}]    
    \    ${val}=    Convert To List    ${VALEXCEL}                
    \    Append To List    ${excelvalue}    ${val}
${x}= Count Values In List  @{excelvalue}

its returning 0 ...... pls do help me out!

Laurent Bristiel

unread,
Nov 6, 2013, 8:19:52 AM11/6/13
to robotframe...@googlegroups.com
This is no more a Robot Framework issue.
If you get 0 item in your list, maybe the GetCellData keyword does not return anything from your sheet.
Add more logging to locate the issue.

Laurent

Maya.R

unread,
Nov 8, 2013, 9:17:00 AM11/8/13
to robotframe...@googlegroups.com
Hi! ... i have found out!! im converting to list and the when i append it its working fine!!!.. thnq 
Reply all
Reply to author
Forward
0 new messages