0

I am compiling my first GUI Application, I am using pyinstaller because it is the one I know, it generates the .exe file. I am using Python 3.8.1 (tags / v3.8.1: 1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32 on AMD 64Bits.

from tkcalendar import Calendar, DateEntry
from tkinter.ttk import * 
from tkinter import messagebox
from tkinter import *
import datetime
import sqlite3

Then when I go to run the exe file I get this error, please, can you tell me what it refers to or where I can find what the error is about or if there is another more effective way to compile.

enter image description here

enter image description here

This is the text generated by the compiler, I can't read it, I don't see if it describes the error I have here.

enter image description here

enter image description here

I appreciate any help, greetings and thanks in advance. If you can recommend me to continue with pyinstaller or if you can recommend another compiler, I have been trying to compile for 1 week and I feel stagnant since I do not advance, I do not get the error.

  • I think you're running the `exe` found in `build`. Try running the one at `dist` – Anwarvic May 26 '20 at 15:03
  • The truth is that in my despair I have run all the exes it generates for me, but if I enter the Sub Dist and I run the exe that is there and the error error continues to appear – Juan carlos Pantoja May 26 '20 at 15:13

1 Answers1

0

I use cx_Freeze and I made a GUI which converts py to exe :

import os
import time
from tkinter import *
from tkinter.filedialog import askopenfile
from tkinter.scrolledtext import ScrolledText
from tkinter.messagebox import *

tk = Tk()
tk.title(".py -> .exe")
tk.resizable(0, 0)

f = None

def browse():
    global f, btn
    try:
        f = askopenfile().name # get the py file
        btn["text"] = os.path.basename(f)
    except:
        f = None

def convert():
    global f, btn, ver, des
    OK = False
    try:
        dots = 0
        for x in ver.get(): # check the number of dots in version
            if x == ".":
                dots += 1
            else:
                x = int(x)
        if dots < 4:
            OK = True
    except:
        showwarning("","The version must be int.int.int... with max 3 dots.")
    if OK:
        try:
            if f is None:
                showwarning("","You must choose a file to convert.")
                btn.focus()
            elif ver.get() == "":
                showwarning("","You must enter a version.")
                ver.focus()
            else:
                with open("setup.py", "w") as f_: # fill a new file setup.py (installer)
                    f_.write("NAME = '" + f +
                        "'\nVERSION = '" + ver.get() +
                        "'\nDESCRIPTION = \"\"\"" + des.get(1.0, "end") +
                        "\"\"\"\nFILENAME = '" + f +
                        "'\n\nfrom cx_Freeze import setup, Executable\nsetup(name = NAME, version = VERSION, description = DESCRIPTION, executables = [Executable(FILENAME)])")
                with open("setup.bat", "w") as f_: # fill a new file setup.bat (installation launcher)
                    f_.write("py setup.py build")
                os.system("setup.bat")
                btn["text"] = "Browse..."
                f = None
                os.remove("setup.py")  # remove files created in this script
                os.remove("setup.bat") #
                showinfo("Information","End. Your exe file is in folder 'build'.")
        except:
            showerror("Error","Error detected.")


# create GUI

Label(text="File to convert").grid(column=0, row=0, sticky="w")

btn = Button(text="Browse...", command=browse)
btn.grid(column=1, row=0)

Label(text="Version").grid(column=0, row=2, sticky="w")

ver = Entry()
ver.grid(column=1, row=2, padx=5)

Label(text="Description").grid(column=0, row=3, sticky="w")

des = ScrolledText(width=15, height=5, wrap=WORD)
des.grid(column=1, row=3)

Label(text="Convert to .exe").grid(column=0, row=4, sticky="w")

Button(text="Convert", command=convert).grid(column=1, row=4, pady=5)

tk.mainloop()

Don't forget to install cx_Freeze !

D_00
  • 1,440
  • 2
  • 13
  • 32
  • Hello D-00, install cx_Freeze, the script, when I compile a simple, small script it works fine, it generates the exe and executes it well, but with the GUI although it generates the exe, the screen appears black and disappears, I can't see the error it generates no longer appears that the .dll file is missing, there is some way to see where the error occurs. Thanks so much for the script and the help. – Juan carlos Pantoja May 29 '20 at 16:50
  • It could be that my version of Python is not compatible with the one I downloaded from cx_Freeze, in advance Thanks for the answers – Juan carlos Pantoja May 29 '20 at 16:52