Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7188

The exe file stops working after being run for a while

$
0
0

I don't know if this is an appropriate question for this site so please tell me if it is not suitable and I will delete it. I have created an executable file with auto-py-to-exe and it works when running. The code which may be important for this question is:

    window = Tk()        window.title("WYD")        label = Label(window, text="What do you want to do to a file?     ")        label.grid(row=0, column=0, sticky=W)        var = IntVar()        rb1 = Radiobutton(window, text="CREATE", variable=var, value=1)        rb1.grid(row=1, column=0, sticky=W)        rb2 = Radiobutton(window, text="ADD", variable=var, value=2)        rb2.grid(row=2, column=0, sticky=W)        rb3 = Radiobutton(window, text="ERASE", variable=var, value=3)        rb3.grid(row=3, column=0, sticky=W)        rb4 = Radiobutton(window, text="DELETE", variable=var, value=4)        rb4.grid(row=4, column=0, sticky=W)        rb5 = Radiobutton(window,text="VIEW", variable=var, value=5)        rb5.grid(row=5, column=0, sticky=W)        button = Button(window, text="EDIT", width=7, command=selectwhat)        button.grid(row=6, column=0, sticky=W)        window.mainloop()    def selectwhat():        selectwhat = var.get()        if selectwhat == 1:            create()        elif selectwhat == 2:            add()        elif selectwhat == 3:            erase()        elif selectwhat == 4:            delete()        else:            view()    def delete():        window.destroy()        global windowd        global entryD        global textD        windowd = Tk()        windowd.title("DELETE")        labelD = Label(windowd, text="What is file name?")        labelD.grid(row=0, column=0, sticky=W)        entryD = Entry(windowd, width=25, bg="light green")        entryD.grid(row=1, column=0, sticky=W)        buttonD = Button(windowd, width=7, text="DELETE", command=deletefile)        buttonD.grid(row=2, column=0, sticky=W)        textD = Text(windowd, wrap=WORD, height=10, width=30, bg="yellow")        textD.grid(row=3, column=0, columnspan=2, sticky=W)        windowd.mainloop()    def deletefile():        name = entryD.get()        if isfile(name):            os.remove(name)            windowd.destroy()            start()        else:            content = "This file doesn't exist. Try creating one."            textD.delete(0.0, END)        textD.insert(END, content) def view():    window.destroy()    global windowv    global entryE    global textE    windowv = Tk()    labelE = Label(windowv, text="What is file name?")    labelE.grid(row=0, column=0, sticky=W)    entryE = Entry(windowv, width=25, bg="light green")    entryE.grid(row=1, column=0, sticky=W)    buttonE = Button(windowv, width=7, text="VIEW", command=viewfile)    buttonE.grid(row=2, column=0, sticky=W)    textE = Text(windowv, wrap=WORD, height=10, width=30, bg="yellow")    textE.grid(row=3, column=0, columnspan=2, sticky=W)    windowv.mainloop()def viewfile():    name = entryE.get()    if isfile(name):        file = open(name, "r")        content = file.read()        textE.delete(0.0, END)        textE.insert(END, content)        backup = Button(windowv, width=7, text="MENU", command=back)        backup.grid(row=5, column=0, sticky=W)    else:        content = "This file doesn't exist. Try creating one."        textE.delete(0.0, END)        textE.insert(END, content)        backup = Button(windowv, width=7, text="MENU", command=back)        backup.grid(row=5, column=0, sticky=W)

This is NOT all the code but the code revolving around my issue. When I run my executable file it opens fine:

How it looks when opened

Say I create a file called FILE:

Creating FILE

The file is created and everything is fine. When I go to delete the file there is no error message - If you look closely you can see I have done the Try Except method to stop application from closing:

Deleting FILE

Everything still runs perfectly as it should. However after creating another file (called FILE) and then using other functions on it (the viewing one seems to be the worst):

Viewing FILE

the delete function stops working:

Delete function not working

I don't not know what the problem is but it comes up at the most annoying of places. I have checked this post on how to fix common issues but it has nothing to do with the program just stopping. I use windows 10 and I have never experienced this issue with any other exe file before. I would appreciate any help. NOTE: I don't know if this is an appropriate question for this site so please tell me if it is not suitable and I will delete it as stated at the beginning of the question.


Viewing all articles
Browse latest Browse all 7188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>