[SOLVED] Error creating a desktop shortcut for a user

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Guillaume_I
Messages: 10
Registration: March 15, 2024 - 4:34 PM

March 18, 2024 - 1:43 PM

Good morning,

I want to create a shortcut for the Wapt console:
I'm following the documentation: 2.1.3.5. Create a desktop shortcut for a logged-in user
(I've noted that I need to use the setup_session function, but I don't understand how to use it... I'm starting from -1 in Python)

Code: Select all

from setuphelpers import *

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, I get the following error:

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.

Installed WAPT version (2.5.4.15342)
- Server OS (Debian 12)
- Operating system of the administration/package creation machine (Windows 10 - 22H2)
Last edited by Guillaume_I on March 25, 2024 - 2:09 PM, edited 1 time.
Environment information:
WAPT Server OS version: Debian 12;
WAPT version: 2.6.0.16937 (Enterprise Edition);
OS of the machine from which the packages are created: Windows 10 22H2;
Secondary repository: Ubuntu 22.04
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

March 18, 2024 - 1:56 PM

Good morning

You should not use `create_user_desktop_shortcut` in the `install` function, but rather `create_desktop_shortcut`

Code: Select all

create_user_desktop_shortcut 
Utilisable en session_setup() (bureau de l’utilisateur)


create_desktop_shortcut 
Utilisable dans fonction install()   (all users)
Guillaume_I
Messages: 10
Registration: March 15, 2024 - 4:34 PM

March 18, 2024 - 2:09 PM

Good morning,

Yes, it works, thank you for the reply.

However, if I want to use create_user_desktop_shortcut, it seems I'm making a mistake again:

Code: Select all

from setuphelpers import *

def session_setup():
    create_user_desktop_shortcut(r'WAPT Console Management', target='C://Program Files (x86)//wapt//waptconsole.exe')
The error in the console is:

Code: Select all

Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\common.py", line 4234, in install_wapt
    exitstatus = setup.install()
AttributeError: module '__waptsetup_ng97cnyb6o__' has no attribute 'install'

AttributeError: module '__waptsetup_ng97cnyb6o__' has no attribute 'install'
Can you tell me what's wrong?

Installed WAPT version (2.5.4.15342)
- Server OS (Debian 12)
- Operating system of the administration/package creation machine (Windows 10 - 22H2)
Environment information:
WAPT Server OS version: Debian 12;
WAPT version: 2.6.0.16937 (Enterprise Edition);
OS of the machine from which the packages are created: Windows 10 22H2;
Secondary repository: Ubuntu 22.04
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

March 18, 2024 - 4:45 PM

Hello Guillaume,

There must be a `def install()` function in `setup.py`. You can add a simple `pass` to the `setup.py` file if there is only a `session_setup()` function

Code: Select all

from setuphelpers import *

def install():
    pass
    
def session_setup():
    create_user_desktop_shortcut(r'WAPT Console Management', target='C://Program Files (x86)//wapt//waptconsole.exe')
Sincerely,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Guillaume_I
Messages: 10
Registration: March 15, 2024 - 4:34 PM

March 25, 2024 - 2:08 PM

Hello Denis,

thank you for your feedback.

I had initial training at the end of last week, and these points are clearer to me now.

Sincerely,

Guillaume Leduc.
Environment information:
WAPT Server OS version: Debian 12;
WAPT version: 2.6.0.16937 (Enterprise Edition);
OS of the machine from which the packages are created: Windows 10 22H2;
Secondary repository: Ubuntu 22.04
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

March 29, 2024 - 10:42

Thanks for the feedback, Guillaume. :-)
Have a good weekend and a happy Easter,
Denis.
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked