Page 1 of 1

Create shortcut

Published: August 5, 2019 - 3:30 PM
by dvinouze
Good morning,
I'm having a small problem installing a shortcut on the desktop:
the function create_user_desktop_shortcut() goes back in error while this one create_desktop_shortcut() works correctly.
However, via pyscripter the installation is correct, both shortcuts are created.

Code: Select all

create_user_desktop_shortcut('Sillage', target='c:\\sillage\\sillage.bat', arguments='http://medprod-tom:52100/sillagePSDM/', wDir='c:\sillage', icon='c:\sillage\sillage.ico')
create_desktop_shortcut('Sillage', target='c:\\sillage\sillage.bat', arguments='http://medprod-tom:52100/sillagePSDM/', wDir='c:\sillage', icon='c:\sillage\sillage.ico')
WAPT console returns

Code: Select all

Installation de SillageInstallation du raccourciTraceback (most recent call last):
  File "C:\Program Files (x86)\wapt\common.py", line 3818, in install_wapt
    exitstatus = setup.install()
  File "c:\windows\temp\waptedrff6\setup.py", line 8, in install
  File "C:\Program Files (x86)\wapt\setuphelpers.py", line 486, in create_user_desktop_shortcut
    sc_path = os.path.join(desktop(0),label)
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 159, in desktop
    return get_path ((shellcon.CSIDL_DESKTOP, shellcon.CSIDL_COMMON_DESKTOPDIRECTORY)[common])
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 140, in get_path
    return shell.SHGetFolderPath (0, folder_id, None, 0)
com_error: (-2147024894, 'Le fichier sp\xe9cifi\xe9 est introuvable.', None, None)
0x80070002 : Le fichier spÚcifiÚ est introuvable.
The error appears to be related to the function sc_path = os.path.join(desktop(0),label) ...

Do you have any idea?

Re: Create shortcut

Published: August 8, 2019 - 2:42 PM
by eblaudy
Hello,

Could you try using the `makepath` function from setuphelpers to create your paths (by the way, one of them is missing a backslash)?

It handles creating the paths directly; you can use it like this: `makepath('c:','sillage','sillage.bat')`

Best regards,

Evan Blaudy

Re: Create shortcut

Published: March 15, 2024 - 5:17 PM
by Guillaume_I
Good morning,

Sorry to resurrect this old thread, but I have exactly the same problem and I can't find a solution.
I do this:
import from setuphelpers *

Code: Select all

def install():
    create_user_desktop_shortcut(r'WAPT Console Management', target='C://Program Files (x86)//wapt//waptconsole.exe')
It works perfectly with Pyscripter (I tried with different paths: c:\pro.., c:/pro...)

But via the wapt console:

Code: Select all

Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\common.py", line 4234, in install_wapt
    exitstatus = setup.install()
  File "C:\WINDOWS\TEMP\wapt8x3n6idv\setup.py", line 5, in install
  File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 3993, in create_user_desktop_shortcut
    sc_path = os.path.join(desktop(0), label)
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 159, in desktop
    return get_path ((shellcon.CSIDL_DESKTOP, shellcon.CSIDL_COMMON_DESKTOPDIRECTORY)[common])
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 140, in get_path
    return shell.SHGetFolderPath (0, folder_id, None, 0)
pywintypes.com_error: (-2147024894, 'Le fichier spécifié est introuvable.', None, None)

0x80070002 : Le fichier spécifié est introuvable
If anyone has any leads, thank you in advance.

Re: Create shortcut

Published: March 18, 2024 - 11:47
by dcardon
Hello Guillaume,

please refrain from posting dead threads; it complicates things for those who maintain the forum. Could you please start a new thread?

And could you please include the Wapt version, edition, operating system, etc. (basically, what's written in red in the forum rules...).

I'm closing this thread.

Regards,

Denis