-1

While execting this, I got the following error.

"FAIL : KeyError: 'first_session'

Error is from the 3rd line, which uses the session_name while calling the defenition _get_xml_func. Need a help to idenity the issue.

def func_get (index=None, *elements,**params):  
    session_name = params.setdefault('session_name', "first_session")
    xml = _get_xml_func(index, *elements, session_name=session_name)
Todor Minakov
  • 19,097
  • 3
  • 55
  • 60
Krishna
  • 49
  • 6

1 Answers1

0

The 1st parameter of setdefault() is the key name, the second - the value to set. The exception is for missing "first_session", which you have passed in as a value, not a key.

Todor Minakov
  • 19,097
  • 3
  • 55
  • 60