I finished my first complete python program and am trying to create an exe. I did successfully build the exe, but it runs and does nothing. I'm guessing it didn't include all the packages. I can specify these with the build_exe_options in cx_Freeze, but I don't know the difference between packages and excludes.
These are all the imports I use in my program
import os
import smtplib
from datetime import datetime, timedelta
from ftplib import FTP_TLS
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
Below is my current setup file
from cx_Freeze import setup, Executable
setup(
name = "FTPConnect",
version = "1.0",
description = "Connects to FTP to download docs",
executables = [Executable("main.py")]
)
I'm guessing I can do something like this, correct?
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os", "smtplib", "datetime", "ftplib", "email.mime.text", "email.mime.multipart" ], "excludes": []}
setup(
name = "FTPConnect",
version = "1.0",
description = "Connects to FTP to download docs",
options = {"build_exe": build_exe_options},
executables = [Executable("main.py")]
)
Well, 'packages'
will include a package with all its submodules, while 'exclude'
will exclude the modules listed.
Read more about all possible values here: http://cx-freeze.readthedocs.io/en/latest/distutils.html#build-exe. It's a list of command line options, but the will work in your script too.
There are a lot of other options allowing to include and exclude zipped modules, DLLs binaries and so on.
Hope this helps!