From a606a4a7f46a65f908d0db2b1a2dcaad6d26f911 Mon Sep 17 00:00:00 2001 From: Adam Abernathy Date: Wed, 25 Oct 2017 14:02:07 -0600 Subject: [PATCH] Add typeguarding for keys that are integers. This issue arises when converting dictionaries that have an integer as the key. --- dicttoxml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dicttoxml.py b/dicttoxml.py index ae1384a..9d36a20 100755 --- a/dicttoxml.py +++ b/dicttoxml.py @@ -142,7 +142,7 @@ def make_valid_xml_name(key, attr): return key, attr # prepend a lowercase n if the key is numeric - if key.isdigit(): + if str(key).isdigit(): return 'n%s' % (key), attr # replace spaces with underscores if that fixes the problem