I am trying to make a .msi with cx_Freeze for Python 3.I can create the .msi no problem, and it installs fine and creates a shortcut, but the shortcut doesn't work because the shortcut isn't running in the installed directory. Any help or suggestions are much appreciated.
Asked
Active
Viewed 787 times
0
-
Please add [mcve]. – zett42 Jun 05 '17 at 21:24
-
I'm not sure what you mean... – Marty Mast Mar 05 '18 at 20:16
1 Answers
2
Make sure you have set working directory option while building your distribution package. You can make a table with all the options set like this:
from cx_Freeze import *
shortcut_table = [
("DesktopShortcut", # Shortcut
"DesktopFolder", # Directory_
"appName_shortcut", # Name
"TARGETDIR", # Component_
"[TARGETDIR]appName.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
'TARGETDIR' # WkDir
)
]
options = {
'bdist_msi': {
'data': {"Shortcut": shortcut_table},
},
}
setup(
name="appName",
options=options,
version="0.0.1",
description='descr',
executables=[Executable("appName.py", base=base,)]
)
Also you can simply give the shortCutName
and shortcutDir
options to the Executable like this:
from cx_Freeze import *
setup(
executables = [
Executable(
"appName.py",
shortcutName="appName_shortcut",
shortcutDir="DesktopFolder",
)
]
)
Based on this answer.

Artem Ilin
- 353
- 2
- 19
-
1Thanks man. I haven't used python in ages now, but maybe it can help someone else. – Marty Mast Feb 21 '19 at 22:16