Python Forum
Python Module to display Dictionairies for debugging
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Module to display Dictionairies for debugging
#1
I have a python application that has three threads that maintain three dictionaries with lists of work that are being processed. As a way to debug I am looking for a module that will allow me to monitor those three dictionaries as records are added or deleted. I have no experience with python GUIs so not sure what i might need.. I definitely want to keep it simple here. the displaying of the dictionaries really only needs to run in my dev environment. I can do the legwork and learn the tool, I just dont know what tool to look at.
Reply
#2
If I had to do this I would perhaps try the ttk.Treeview wigdet in tkinter to display the dictionaries as tables.
Reply
#3
or:
def display_dict(dictname, level=0):
    indent = " " * (4 * level)
    for key, value in dictname.items():
        if isinstance(value, dict):
            print(f'\n{indent}{key}')
            level += 1
            display_dict(value, level)
        else:
            print(f'{indent}{key}: {value}')
        if level > 0:
            level -= 1
Reply
#4
You could use an IDE's debugging to view contents of variables
for instance VS code
VS code General Debugging
Python debug configurations in Visual Studio Code
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to display <IPython.core.display.HTML object>? pythopen 3 45,703 May-06-2023, 08:14 AM
Last Post: pramod08728
  How can I display dictionary in a gui window in Python? C0D3R 2 1,661 Apr-07-2022, 07:33 PM
Last Post: C0D3R
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 2,172 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray
  python display with '\\' when prints with key-value in dictionary maiya 12 9,306 May-30-2020, 05:56 PM
Last Post: maiya
  How To Display this Python Code in Web browser? pradhan 1 3,275 Jul-14-2019, 06:59 PM
Last Post: snippsat
  Escape sequences display in python Uchikago 1 2,376 Jun-27-2019, 03:25 PM
Last Post: Gribouillis
  Newb question: Debugging + Linting Python in Visual Studio Code Drone4four 1 2,388 Apr-15-2019, 06:19 AM
Last Post: perfringo
  Debugging Python Astrikor 1 2,098 Dec-04-2018, 12:27 PM
Last Post: Larz60+
  python 'SMTP debugging server' not starting local error pcsailor 1 3,407 Nov-26-2018, 10:13 PM
Last Post: micseydel
  Debugging inside a thread with Python 2.3.4 zerajera 0 1,675 Nov-21-2018, 01:43 PM
Last Post: zerajera

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020