type(dict variable) returns <class 'robot.utils.dotdict.DotDict'> instead of <type 'dict'>

90 views
Skip to first unread message

Dana

unread,
Nov 10, 2015, 6:16:48 AM11/10/15
to robotframework-users
hi,

I am using robotframework 2.9

through robotframework keywords if send a dict variable to my python code and when i try to find the type(dict variable) it returns <class 'robot.utils.dotdict.DotDict'> instead of <type 'dict'>.
as an example 

    ${input} = Create Dictionary key1=value1   key2=value2

    Find Type    ${input}


def find_type(input):
  if type(input) == dict:
      ..do something...

other types like int, list are returned properly.

Kindly help me with the same.

Tatu Aalto

unread,
Nov 10, 2015, 1:29:52 PM11/10/15
to robotfra...@gmail.com, robotframework-users

Ugh

In RF there is own class to implement the dictionary feature. Example in RF dictionaries are ordered (not sure is it true in all cases) and in Python dictionaries are not ordered. For this and some other reason RF dictionaries are not same as Python dictionaries. Therefore type() will show the result what you are seeing. But the type() should yield in same results for all RF dictionaries.

-Tatu
Send from my mobile

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Dana

unread,
Nov 11, 2015, 3:31:12 AM11/11/15
to robotframework-users, robotfra...@gmail.com
Thanks for the clarification


On Tuesday, November 10, 2015 at 7:29:52 PM UTC+1, Tatu Aalto wrote:

Ugh

In RF there is own class to implement the dictionary feature. Example in RF dictionaries are ordered (not sure is it true in all cases) and in Python dictionaries are not ordered. For this and some other reason RF dictionaries are not same as Python dictionaries. Therefore type() will show the result what you are seeing. But the type() should yield in same results for all RF dictionaries.

-Tatu
Send from my mobile

On 10 Nov 2015 1:16 p.m., "Dana" <robotfra...@gmail.com> wrote:
hi,

I am using robotframework 2.9

through robotframework keywords if send a dict variable to my python code and when i try to find the type(dict variable) it returns <class 'robot.utils.dotdict.DotDict'> instead of <type 'dict'>.
as an example 

    ${input} = Create Dictionary key1=value1   key2=value2

    Find Type    ${input}


def find_type(input):
  if type(input) == dict:
      ..do something...

other types like int, list are returned properly.

Kindly help me with the same.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages