I'm trying to create an executable from a .py file. I've managed to create the .exe with cx_Freeze but when I double click on it nothing happens. I've looked at the event viewer error and this shows up:
Faulting application name: python.exe, version: 3.8.150.1013, time stamp: 0x5da4cb35
Faulting module name: ntdll.dll, version: 10.0.17763.831, time stamp: 0x6071cf9d
Exception code: 0xc0000005
Fault offset: 0x000763a3
Faulting process id: 0x16a8
Faulting application start time: 0x01d5ddbc52c0cd5f
Faulting application path: C:\Users\admin\AppData\Local\Programs\Python\Python38-32\python.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report Id: dc486cf5-4b21-4ac7-9e96-02e0fb4ee0eb
Faulting package full name:
Faulting package-relative application ID:
The initial code is:
import shutil
import os
import os.path
from os import path
import tkinter as tk
from tkinter.messagebox import showinfo
def move():
dir = initialdir.get()
exts = b.get()
finalDir = c.get()
files = os.listdir(dir)
exts = exts.split()
initialFinalDir = finalDir
for ext in exts:
ext = ext.lower()
finalDir = finalDir + '\\' + ext
if not os.path.exists(finalDir):
os.mkdir(finalDir)
for file in files:
if file.endswith(ext):
initialFile = dir + '\\' + file
shutil.move(initialFile, finalDir)
finalDir = initialFinalDir
showinfo("All done")
win = tk.Tk()
win.title("Movable")
tk.Label(win, text="Initial folder").grid(row=0)
initialdir = tk.Entry(win)
initialdir.grid(row=0, column=1)
tk.Label(win, text="Extensions").grid(row=1)
b = tk.Entry(win)
b.grid(row=1, column=1)
tk.Label(win, text="Final folder").grid(row=2)
c = tk.Entry(win)
c.grid(row=2, column=1)
image = tk.PhotoImage(file="button_smaller.PNG")
button = tk.Button(win, command=move, image=image)
button["bd"] = "0"
button.grid(row=3, column=2)
win.mainloop()
and the setup code is:
import cx_Freeze
import sys
import os
base = None
if sys.platform == 'win32':
base = "Win32GUI"
executables = [cx_Freeze.Executable("first.py", base=base, icon="icoana.ico")]
cx_Freeze.setup(
name="Movable-test",
options={"build_exe": {"packages":["tkinter"], "include_files":["icoana.ico", "button_smaller.png"]}},
version="0.01",
description="First test of Movable",
executables=executables
)
Can you please help me figure out what is happening, thank you :)
User contributions licensed under CC BY-SA 3.0