From 1bca217c0344ebe2086f3bfe5fe23bd455decfec Mon Sep 17 00:00:00 2001 From: Artur-Pioro Date: Wed, 25 May 2022 18:45:11 +0200 Subject: [PATCH] Key maybe an int. This would lead to exception. Turn keys to str for sorting. --- show_struct.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/show_struct.py b/show_struct.py index 701d1af..ba74fa1 100755 --- a/show_struct.py +++ b/show_struct.py @@ -40,10 +40,15 @@ def outline(self, data): ret = [] for path in sorted(self.paths): - ret.append({ - 'path': path, - 'values': sorted(self.values_for_path[path].keys()) - }) + try: + ret.append({ + 'path': path, + 'values': sorted(self.values_for_path[path].keys(), key=str) + }) + + except Exception as e: + import ipdb; ipdb.set_trace() + pass return ret