Fatal Error! - Failed to execute the script
See original GitHub issueHi, I created a tkinter application and tried converting it to exe using auto-py-to-exe
.
when I run the exe I get Fatal Error! - Failed to execute the script
please help.
My code:
`import os import tkinter from tkinter import messagebox from tkinter import filedialog from tkinter import * import time import sys import pandas as pd from bs4 import BeautifulSoup from selenium import webdriver import win32com.client as win32 import time import numpy as np import traceback import datetime def config(): return datetime.date.today() < datetime.date(2018,11,16)
#b=tkinter.Tk()
def send_email(to_addr,subject,carrier_name,vr_id,trailer):
#print(mail.Body)
#mail.HTMLBody = '<h2>HTML Message body</h2>' #this field is optional
# To attach a file to the email (optional):
#attachment = "Path to the attachment"
#mail.Attachments.Add(attachment)
mail.Send()
def process(fc_value,file_addr): try: carrier_df=pd.read_excel(file_addr) #drop_down_value=str(sys.argv[1]) url= ‘https://mysite.com’
#drop_down_value=''
driver=webdriver.Chrome()
driver.get(url)
time.sleep(2)
driver.find_element_by_xpath(f"//select[@id='availableNodeName']/option[text()='{drop_down_value}']").click()
#driver.find_element_by_xpath("""//select[@id="availableNodeName"]/option[text()='MSP1']""").click()
time.sleep(2)
soup=BeautifulSoup(driver.page_source,'html.parser')
#print(soup)
no_of_pages=int(soup.find(class_='paginate_of').find('strong').text)
df_list=[]
for i in range(1,no_of_pages):
df=pd.read_html(driver.page_source)
df=df[5]
df_list.append(df)
#print(df)
next_button=driver.find_elements_by_xpath('//a[@class="next nxt fg-button ui-button ui-state-default"]')
if next_button:
next_button[0].click()
time.sleep(2)
driver.close()
main_df=pd.concat(df_list)
main_df['Status']=main_df['Status'].fillna('n/a')
main_df['Status']=main_df['Status'].astype(str)
main_df=main_df[main_df['Status'].str.contains('Finished Loading')]
#main_df.to_excel('test_data.xlsx',index=False)
#pre-processing dataframes to proceed
carrier_df['SCAC']=carrier_df['SCAC'].str.strip('[]')
main_df['Carrier']=main_df['Carrier'].apply(lambda x: x.split('[')[0])
#filter only matching email on both df
columns_needed=['Sort/Rodfdfute','Locatdfdfion','VdfdfR Id','Cdfdfdfddfdfdfdfdfdarrier','Tradfddfiler']
main_df=main_df[columns_needed]
main_df['Carrier']=main_df['Carrdfdfier'].str.strip()
carrier_df['SCAC']=carrier_df['dfd'].str.strip()
final_df=main_df[main_df['Cadfdfrrier'].isin(carrier_df['dfdfdfdf'])]
final_df.loc[:,'email']=final_df['Carriedfdfddr'].map(dict(zip(carrier_df['dfdfdf'],carrier_df['Email Address'])))
#Handling multiple email id's
final_df[columns_needed]=np.repeat(final_df[columns_needed].values,(final_df['email'].str.split(',').str.len()),axis=0)
final_df['email']=','.join(final_df['email'].values.flatten()).split()
#removing tick mark in trailer column
final_df['Trailer']=final_df['Trailer'].str[:-2]
for to_addr, vr_id, trailer,carrier in zip(final_df['email'],final_df['VR Id'],final_df['Trailer'],final_df['Carrier']):
send_email(to_addr=to_addr,subject='pull',carrier_name=carrier,mjj=vr_id,trailer=njj)
return 'completed'
except Exception:
status=traceback.format_exc()
return status
print('completed')
a=tkinter.Tk()
a.geometry(“500x600+500+100”) a.title(‘Early pull Application by ROC’)
def set_value(text): fc_value=text_textbox1.get() file_addr=text_textbox2.get() status=‘processing’ if config(): status=process(fc_value,file_addr) my_label2.config(text=status)
def fileopen(): file1=filedialog.askopenfile() file1=file1.name text_textbox2.set(str(file1))
#defining objects my_label2=tkinter.Label(a,text=“Facility Code ex - ONT8”,fg=“green”,bg=“white”,font=(“aerial”,10,“italic”)) text_textbox1=tkinter.StringVar() text_textbox2=tkinter.StringVar() my_msgbox=tkinter.Entry(a,textvariable=text_textbox1)
my_button=tkinter.Button(a,text='Go ',command=lambda : set_value(‘dfdf’)) txt_label=tkinter.Entry(a,textvariable=text_textbox2,width=38)
btn_browse=tkinter.Button(a,text=“Browse”,fg=“red”,bg=“white”,command=fileopen)
#placing objects btn_browse.place(x=300,y=200) txt_label.place(x=43,y=200) my_label2.place(x=15,y=100) my_msgbox.place(x=45,y=130) my_button.place(x=220,y=120) a.mainloop() `
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
requirements.txt states that PyInstaller 3.4 or above is required. In the output you have pasted here, PyInstaller 3.3.1 was being used.
Works fine after updating pyinstaller. Thanks for your time @brentvollebregt . You are a life savior