Page 1 of 1
[SOLVED] run_nofatal() never finishes
Published: June 7, 2024 - 5:58 PM
by sebastien4444
Hello,
I'm having a small problem with this function.
I need to install a file from an .exe, to which I must provide the /verysilent parameter for silent installation.
Since the install_exe_if_needed function doesn't seem to allow adding parameters (like install_msi_if_needed does with properties), I'm using run_as_administrator(myfile.exe, params="/verysilent").
Following that, I need to copy files to the directory where the software was installed, so the installation must be complete for the copy path to exist. Therefore, I'm using wait_uninstallkey_present() with the uninstallation key.
Finally, I need to launch an .exe file located in the installation directory to start the service on the PC.
Since this .exe doesn't return an exit code, I'm using run_nofatal() to avoid an error.
My problem is that my .exe file runs correctly because I see the service appear on my machine, but the print("starting OK") that I add immediately afterward is never displayed; therefore, the installation execution never finishes.
Isn't the purpose of this function precisely to execute and exit without waiting for anything?
Re: run_nofatal() never finishes
Published: June 7, 2024 - 6:22 PM
by sfonteneau
sebastien4444 wrote: ↑June 7, 2024 - 5:58 PM
Since the install_exe_if_needed function does not seem to allow adding parameters (as install_msi_if_needed does with properties), I use run_as_administrator(myfile.exe, params="/verysilent").
You can send your setup.py file; that will be simpler
and if install_exe_if_needed allows adding an argument with silentflags:
Example with VLC:
Code: Select all
install_exe_if_needed("vlcsetup.exe",silentflags="/S",key="VLC media player",min_version="3.0.20")
run_as_administrator should not be used in packages since wapt launches a system account and is therefore unnecessary.
just use run
Re: run_nofatal() never finishes
Published: June 10, 2024 - 11:25
by sebastien4444
Hello,
Thank you for your feedback.
Indeed, during the installation, I hadn't noticed the presence of the silent flag parameter in `install_exe_if_needed`.
However, this doesn't solve my problem with launching the .exe file.
By using `run()` instead of `run_as_administrator()`, my service does start (as when I used `run_nofatal`), but the script execution gets stuck at that line and therefore doesn't finish (so if I build the package as is and deploy it to a PC, the installation never completes).
Thank you in advance for your feedback.
Re: run_nofatal() never finishes
Published: June 10, 2024 - 11:46
by sfonteneau
You can send your setup.py file; that will be simpler

Re: run_nofatal() never finishes
Published: June 11, 2024 - 09:44
by sebastien4444
Good morning,
Here's what it looks like:
Code: Select all
from setuphelpers import *
def install():
install_exe = "UltraVNC Installer.exe"
config_file = "ultravnc.ini"
install_path = makepath("C:","Program Files","uvnc bvba","UltraVNC")
service_path = makepath("C:","Program Files","uvnc bvba","UltraVNC","winvnc.exe")
install_exe_if_needed(install_exe, , silentflags="/verysilent", key="Ultravnc2_is1")
print("VNC installé")
filecopyto(config_file, install_path)
print("Config copiée")
run(service_path)
print("Service lancé")
The software installs, the config file is copied correctly, the service starts correctly but the "Service started" print statement is never reached and the script only finishes after the timeout (and therefore with an error).
Re: run_nofatal() never finishes
Published: June 13, 2024 - 11:29
by dcardon
Hi Sébastien,
it's very likely that the execution of "winvnc.exe" isn't returning control (basically, it's not running as a service), and therefore the run() function isn't returning control. After the timeout, it will kill the runnable winvnc.exe, and the package will run into an error.
There's probably a way to declare winvnc as a service and run it as such to avoid this blocking issue.
Regards,
Denis
Re: run_nofatal() never finishes
Published: June 14, 2024 - 11:46
by sebastien4444
Hello,
thank you for your reply.
Yes, that's it, as soon as the error is raised, the program stops.
I've tried different Python functions from various libraries that allow file execution, and it doesn't change anything.
The strange thing is that launching winvnc.exe via a command prompt doesn't cause this problem: the program starts, I get the prompt almost instantly, and the program remains active.
I thought execution functions in Python were the same as launching a cmd command.
Oh well, I'll do it another way. Thanks again.
Re: run_nofatal() never finishes
Published: June 14, 2024 - 12:35
by dcardon
Hi again Sébastien,
have you taken a look at the package we have on the store
https://wapt.tranquil.it/store/en/detai ... _PROD.wapt?
If the goal is to run it as a service, this is the best way to do it.
Otherwise, if you really need to replicate the behavior of launching a command in the background, you can look at the "start" command line.
Best regards,
Denis
Re: run_nofatal() never finishes
Published: June 14, 2024 - 3:50 PM
by sebastien4444
Great, thanks!
Looking at the setup.py file in your package, I saw that I needed to add the "-install" parameter to the execution of winvnc.exe (which is actually in the UltraVNC "Command Line" documentation, but I had missed it

).
Re: run_nofatal() never finishes
Published: June 17, 2024 - 09:49
by dcardon
Hi Sébastien,
thanks for your feedback

. Glad you found a solution.
Feel free to spread the word about WAPT; it also spreads a lot through word of mouth

!
Best regards,
Denis