Skip to content

Commit

Permalink
Python2&3 compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Vikrant Balyan (vvb) <vvb@cisco.com>
  • Loading branch information
vvb committed Aug 23, 2018
1 parent cf628b8 commit 9180afe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions imcsdk/imcxmlcodec.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def extract_root_elem(xml_str):
'''
root_element = extract_root_elem(xml_str)
"""

if type(xml_str) is not str:
xml_str = xml_str.decode('utf-8')
xml_str = xml_str.strip("\x00")
root_elem = ET.fromstring(xml_str)
return root_elem
Expand All @@ -82,7 +83,8 @@ def from_xml_str(xml_str, handle=None):
'''\n
root_element = extract_root_elem(xml_str)\n
"""

if type(xml_str) is not str:
xml_str = xml_str.decode('utf-8')
xml_str = xml_str.strip("\x00")
root_elem = ET.fromstring(xml_str)
if root_elem.tag == "error":
Expand Down

0 comments on commit 9180afe

Please sign in to comment.