I am using pyinstaller to convert .ipynb file to .exe file as i want my peers members to use it without depending on python but when i try to run the exe file i get the following error
Traceback (most recent call last): File "Bot.ipynb", line 232, in NameError: name 'null' is not defined
Two things to consider here are
- I dont have this particular keyword "null"
- my total line of codes are less than 232
Here is my piece of code:
from tkinter import *
import PIL
from PIL import ImageTk
from PIL import Image
import tkinter as tk
import webbrowser
from tkinter import scrolledtext
from datetime import datetime
root = tk.Tk()
def update_title():
current_date_time = datetime.now().strftime("%A,%d-%b-%Y %H:%M:%S")
root.title(f"Welcome - {current_date_time}")
root.after(1000, update_title)
update_title()
root.geometry("1000x700")
root.configure(bg="#D22730")
def open_website(url):
webbrowser.open(url)
# Function to handle user input and generate bot response
def get_bot_response():
user_input = input_box.get("1.0", tk.END).strip().lower()
output_box.configure(state='normal')
output_box.delete("1.0",tk.END) # Clear previous output
output_box.insert(tk.END, 'User: {}\n'.format(user_input))
# Check user queries and provide instructions accordingly
if 'how to register to ekincare' in user_input or 'ekincare' in user_input or 'medicine' in
user_input or 'tele-medicine' in user_input:
instructions = "partnered with ekincare, a leading digital healthcare provider
to provide you with 24/7 unlimited access to doctor consultation. The coverage is for the
employee and upto 5 family members. \n\n"
instructions += "The key services provided are: \n"
instructions += "1. 24/7 unlimited teleconsultation – (General Physician only) via chat or audio \n"
instructions += "2. Health Risk Assessment – Track your and your family’s health \n"
instructions += "3. COVID Care Management- Home Isolation support for COVID treatment \n"
instructions += "4. Discounted Pharmacy – Up to 20% discount on medicines ordered online (borne by the employee) \n"
instructions += "5. Discounted Medical Tests - Up to 40% discount on home sample collection (borne by the employee) \n"
instructions += "6. For any queries / support required, please reach out to ekincare at help@ekincare.com or call at +91 49 6816 7274 \n"
instructions += "7. For more details, please refer: https://hrdirect.service-now.com/sys_attachment.do?sys_id=f3c0bd451b37959868314376b04bcbf9 \n"
response = instructions
elif 'how to add a new domestic beneficiary using mobile banking app' in user_input or 'payee' in user_input or 'add beneficiary' in user_input:
instructions = "To add new benefiary, please follow the below steps. \n\n"
instructions += "1. Login to your Mobile Banking App \n"
instructions += "2. Select 'Move Money' tab \n"
instructions += "3. Select 'Pay & Transfer' \n"
instructions += "4. Choose the account you’re making the payment from \n"
instructions += "5. Under the 'my beneficiaries' section Now you’ll see an option to 'Add a new beneficiary' at the top of your screen \n"
instructions += "6. Select and follow the onscreen instructions \n"
instructions += "7. 'Confirm' your instruction \n"
response = instructions
else:
response = "Sorry, I need to get trained on this topic"
output_box.insert(tk.END, 'Bot: {}\n'.format(response))
output_box.configure(state='disabled')
output_box.see(tk.END)
input_label = tk.Label(root, text="User Input:",anchor="w",bg="black",fg="white",font=("Arial",12))
input_label.pack(anchor="w")
# Input Box
input_box = scrolledtext.ScrolledText(root, height=7, width=100,font=("Arial",12))
input_box.pack()
output_label = tk.Label(root, text="Bot Response:",anchor="w",bg="black",fg="white",font=("Arial",12))
output_label.pack(anchor="w")
# Output
output_box = scrolledtext.ScrolledText(root, height=15,width=100,wrap=tk.WORD,font=("Arial",12))
output_box.pack()
output_box.configure(borderwidth=1, relief="solid")
#button_font = font.Font(size=12,"bold")
send_button = tk.Button(root, text="Find", command=get_bot_response,bg="black",fg="white",width=8,height=1, font=("Arial",12,"bold"))
send_button.pack()
button_frame = tk.Frame(root)
button_frame.pack(side="bottom",pady=10)
button1 = tk.Button(root, text="Service now", relief="flat",width=15, height=1,font=("Arial",10,"bold"),command=lambda: open_website("https://itid.service-now.com/servicenow"))
button1.pack(side="left",padx=5)
root.mainloop()