✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Plotly charts not working

Hi everyone…
I am new to python and developed a tkinter app to generate Plotly charts. This worked well in Pycharm and convered to .exe file using pyinstaller.

This .exe application is not generating plotly graphs where as same python code is generating charts in the browser using Pycharm.

What do I need to do?

from tkinter import *
import tkinter as tk
import teradata
import pandas as pd
import plotly.express as px
import plotly.io as pio
import plotly.offline as ply
from tkinter import messagebox
import re
pio.renderers.default = “browser”

root=Tk()
level = StringVar()
level.set(‘Organisation’)
root.title(‘Resource Consumption Analysis Tool’)

mymenu=Menu(root)
root.config(menu=mymenu)

canvas = Canvas(root, height=646, width=1100)
canvas.pack()

frame = Frame(bd=10, relief=RAISED)
frame.place(relx=0.3, rely=0.2, relwidth=0.4, relheight=0.5)

Loginbutton = Button(frame, text=‘Login’, font=(‘Arial’, 13), fg=“Black”, bd=2, height=1, width=12,
command=lambda: analysis())
Loginbutton.grid(row=5, column=0, padx=15, pady=15)

try:
def analysis():
data = dict(
character=[“Eve”, “Cain”, “Seth”, “Enos”, “Noam”, “Abel”, “Awan”, “Enoch”, “Azura”],
parent=["", “Eve”, “Eve”, “Seth”, “Seth”, “Eve”, “Eve”, “Awan”, “Eve”],
value=[10, 14, 12, 10, 2, 6, 6, 4, 4])

    fig = px.sunburst(
        data,
        names='character',
        parents='parent',
        values='value',
    )
    fig.show()

except:
tk.messagebox.showwarning(title=‘Warning’, message=e)

root.mainloop()


Below is the error,

The first argument to the plotly.graph_objs.layout.Template constructor must be a dict or an instance of :class: plotly.graph_objs.layout.Template

Thanks,
Sai