Page 1 of 1

parameter problem in the create_programs_menu_shortcut() function

Published: May 10, 2023 - 11:59
by brice73
Good morning,
I am currently creating a package for installing DaVinci Resolve software. This package includes a shortcut targeting the string "C:\Program Files\Blackmagic Design\DaVinci Resolve\Resolve.exe" -pg

The shortcut is created using a shortcut dictionary in the setup.py file as follows:

Defining the shortcut parameters:

Code: Select all

mat_rac = {r'Multimedia':[{'shortcutname':'DaVinci Blackmagic Proxy Generator Lite','cible':r'"C:\Program Files\Blackmagic Design\DaVinci Resolve\Resolve.exe" -pg','wdir':r'C:\Program Files\Blackmagic Design\DaVinci Resolve'},]}
then create the shortcut:

Code: Select all

for matiere in mat_rac:
        for shortcut in mat_rac[matiere]:
            if not isfile(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\\'+matiere+'\\'+shortcut['shortcutname']):
                create_programs_menu_shortcut(shortcut['shortcutname'],target=shortcut['cible'],folder=matiere,wDir=shortcut['wdir'])


During installation, a parameter error occurs with the following messages:

Traceback (most recent call last):
File "C:\Program Files (x86)\wapt\common.py", line 4074, in install_wapt
exitstatus = setup.install()
File "C:\waptdev\col73-davinci-resolve_18.1.4.9_Windows_DEV\setup.py", line 49, in install
create_programs_menu_shortcut(shortcut['shortcutname'],target=shortcut['cible'],folder=matiere,wDir=shortcut['wdir'])
File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 3941, in create_programs_menu_shortcut
create_shortcut(sc, target, arguments, wDir, icon)
File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 3840, in create_shortcut
winshell.CreateShortcut(path, target, arguments, wDir, (icon, 0), '')
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 887, in CreateShortcut
lnk = shortcut (Target)
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 507, in shortcut
return Shortcut.from_target (source)
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 414, in from_target
return cls (
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 391, in __init__
setattr (self, k, v)
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 456, in _set_path
self._shell_link.SetPath (path)
pywintypes.com_error: (-2147024809, 'Incorrect parameter.', None, None)

FATAL ERROR: 0x80070057: Incorrect parameter.
Exit code: 3.


This error does not occur when double quotes "" are removed from inside the single quote delimited string ' ' in the shortcut target, but the shortcut is then no longer operational.

Is there a way to solve this problem?

Re: Parameter problem in the create_programs_menu_shortcut() function

Published: May 15, 2023 - 4:39 PM
by brice73
Edit:
The problem is solved! :-) The argument '-pg' should actually be passed to the 'arguments' in the create_programs_menu_shortcut() function and not to the 'target'. (The same applies in PowerShell as well).