Session setup

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
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

January 23, 2017 - 2:23 PM

Good morning,
I'm trying to use session_setup to copy a SketchUp plugin to the users' appdata/roaming directory. But the files are never copied when the session starts. If I manually run the command "wapt-get session-setup dst-sketchup-make", I get:

Configuring dst-sketchup-make ... Done


Here is my session_setup code in setup.py:

Code: Select all

def session_setup():
    # Copie des fichiers de l'extension SPL vers C:\Users\<USER>\AppData\Roaming\SketchUp\SketchUp 2017\SketchUp\Plugins
    if not isdir(makepath(user_appdata(),'SketchUp','SketchUp 2017','SketchUp','Plugins')):
            print('creation du dossier Plugins')
            mkdirs(makepath(user_appdata(),'SketchUp','SketchUp 2017','SketchUp','Plugins'))
    for fn in glob.glob('sketchup-stl-2.1.6/*'):
        filecopyto(fn,makepath(user_appdata(),'SketchUp','SketchUp 2017','SketchUp','Plugins'))
        print('Copie des fichiers du plugin SPL Sketchup')
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

January 23, 2017 - 2:59 PM

Hello, as indicated in the documentation:

https://www.wapt.fr/fr/doc/CreationPaqu ... sion-setup

, with session_setup, it is not possible to access files contained within the package.

You will need to copy them beforehand to a directory.
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

January 24, 2017 - 07:10

Thank you! Sorry, I hadn't read the documentation properly :oops:
To launch a program at each startup, prefer the use of a startup script contained in (shell:startup) or Startup All Users (shell:common startup), or via a local startup group policy.
Can we use the "shell:startup", "shell:Personal", etc. instructions in makepath?
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

January 24, 2017 - 09:29

Hello

, yes, it's not very clear in the documentation, I'll redo it...

You can call `startup(1)` for the path to the startup directory for all users

, and you can call `startup(0)` for the path to the startup directory for the current user. (Only in session-setup)

The principle is therefore to copy the script you're interested in into the startup directory you're interested in.
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

January 24, 2017 - 11:16

So I'm having trouble copying the directory to a temporary folder. The goal is to then copy it to each user's AppData/Roaming directory during session setup. During installation, I tried copying it to a C:\tmp directory, but wapt apparently doesn't have the correct permissions.

Excerpt from install():

Code: Select all

        mkdirs(makepath('C:','tmp','sketchup-stl-2.1.6'))
        for fn in glob.glob('sketchup-stl-2.1.6/*'):
             filecopyto(fn,makepath('C:','tmp','sketchup-stl-2.1.6'))

Code: Select all

Extrait du session_setup():
        if not isdir(makepath(user_appdata(),"SketchUp","SketchUp 2017","SketchUp","Plugins")):
            mkdirs(makepath(user_appdata(),"SketchUp","SketchUp 2017","SketchUp","Plugins"))
        copytree2(makepath('C:','tmp','sketchup-stl-2.1.6'),makepath(user_appdata(),"SketchUp","SketchUp 2017","SketchUp","Plugins"))
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

January 25, 2017 - 2:49 PM

Here is the error when copying to "C:\tmp" or "C:\windows\temp\":

IOError: [Errno 13] Permission denied: 'sketchup-stl-2.1.6\\sketchup-stl'

Code: Select all

        for fn in glob.glob('sketchup-stl-2.1.6/*'):
             filecopyto(fn,makepath('C:','windows','temp','sketchup-stl-2.1.6'))
Locked