0

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.

Marty Mast
  • 26
  • 6

1 Answers1

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