[SOLVED] [Error 145] The directory is not empty

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
erickeke
Messages: 16
Registration: June 12, 2019 - 10:33

July 10, 2019 - 11:19

Hello,

when installing packages I often get this kind of message:

[Error 145] The directory is not empty: 'c:\\users\\admin\\appdata\\local\\temp\\waptvqjgz'

I have to add a time.sleep(5) to avoid the error.

I can't say for sure if it happens every time using the same function: in the case above:
install_exe_if_needed("setup-gprolog-1.4.5-msvc-x64.exe",'/VERYSILENT /SUPPRESSMSGBOXES /NORESTART',key='GNU Prolog_is1',min_version='1.4.5')

It happens systematically with this installer; if I remove and reinstall, the same thing happens.

However, the folder is eventually deleted from temp.

I don't have antivirus software on my test machine, which runs Windows 7 64-bit and uses Wapt client version 1.7.3.5.

It's not a big deal; it's not a major bug. ;-)

Regards.
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

July 11, 2019 - 11:29

Hello Erickeke,
erickeke wrote: Jul 10, 2019 - 11:19 AM When installing packages, I often get this kind of message:

[Error 145] The directory is not empty: 'c:\\users\\admin\\appdata\\local\\temp\\waptvqjgz'

I have to add a time.sleep(5) to avoid the error.

I couldn't say for sure if it happens every time using the same function: in the case above:
install_exe_if_needed("setup-gprolog-1.4.5-msvc-x64.exe",'/VERYSILENT /SUPPRESSMSGBOXES /NORESTART',key='GNU Prolog_is1',min_version='1.4.5')

It happens systematically with this installer; if I do remove and reinstall, the same thing happens.

However, the folder is eventually deleted from the temp directory.

I don't have antivirus software on my test machine, which runs Windows 7 64-bit and uses Wapt client version 1.7.3.5.

It's not a big deal; it's not a major bug. ;-)
The installer probably needs to create temporary files in the directory where the package is unzipped.

Indeed, the temporary wapt directory (here c:\\users\\admin\\appdata\\local\\temp\\waptvqjgz, prefix wapt and a random suffix) is created during installation to unzip the contents of the WAPT package. Afterward, WAPT executes the Python script setup.py. If, in setup.py, you call an installer that unzips into the current directory, and then deletes its files a little too late after the executable closes, I think you could encounter the problem you're describing.

The option you're suggesting, adding a sleep(5), should give setup.exe time to clean up (even though it has already handed control back to run()...). Packaging isn't an exact science :-)

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
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

July 12, 2019 - 1:34 PM

dcardon wrote: July 11, 2019 - 11:29 Hello Erickeke,
erickeke wrote: Jul 10, 2019 - 11:19 AM When installing packages, I often get this kind of message:

[Error 145] The directory is not empty: 'c:\\users\\admin\\appdata\\local\\temp\\waptvqjgz'

I have to add a time.sleep(5) to avoid the error.

I couldn't say for sure if it happens every time using the same function: in the case above:
install_exe_if_needed("setup-gprolog-1.4.5-msvc-x64.exe",'/VERYSILENT /SUPPRESSMSGBOXES /NORESTART',key='GNU Prolog_is1',min_version='1.4.5')

It happens systematically with this installer; if I do remove and reinstall, the same thing happens.

However, the folder is eventually deleted from the temp directory.

I don't have antivirus software on my test machine, which runs Windows 7 64-bit and uses Wapt client version 1.7.3.5.

It's not a big deal; it's not a major bug. ;-)
The installer probably needs to create temporary files in the directory where the package is unzipped.

...
Upon reflection, this case could be handled within the standard WAPT installation framework. If the directory isn't empty and deletion fails, we wait 5 seconds and try again. If it still fails the second time, we flag it as an error; otherwise, it successfully deletes the directory.

We'll see about integrating that into a future version.

Sincerely,

Denis Cardon
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
erickeke
Messages: 16
Registration: June 12, 2019 - 10:33

September 4, 2019 - 7:35 PM

Thank you, sorry for not replying, I hadn't seen your message… :-)
Locked