Page 1 of 1

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

Published: July 10, 2019 - 11:19
by erickeke
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.

Re: [Error 145] The directory is not empty

Published: July 11, 2019 - 11:29
by dcardon
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

Re: [Error 145] The directory is not empty

Published: July 12, 2019 - 1:34 PM
by dcardon
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

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

Published: September 4, 2019 - 7:35 PM
by erickeke
Thank you, sorry for not replying, I hadn't seen your message… :-)