0

I've got a problem. I've got a program // script, which works perfectly, but when I compile it using cx_Freeze, it doesn't work: Name "filedialog" is not defined. Do I have to import it on another way?? My Script part:

from tkinter import *
from shutil import *
import sys
import os
#Vars:
location = os.path.dirname(sys.argv[0])+"/"
if os.path.isfile(location+"filedic.txt"):
    file = open(location+"filedic.txt","r").read()
else:
    fiRoot = Tk()
    fiRoot.withdraw()
    file = str(filedialog.askdirectory())

And my setup script:

import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(
    name = "BlackChat",
    version = "1.3",
    description = "BlackChat was programmed by David Jandrey",
    executables = [Executable("BlackChat.py", base = base,icon = "BlackChat.ico")])

Thanks for coming answers.

1 Answers1

0

Reposting as an answer:

Doing from tkinter import filedialog explicitly might make it work - it looks like cx_Freeze isn't copying the filedialog module.

Thomas K
  • 39,200
  • 7
  • 84
  • 86