Page 1 of 1
need_install() got an unexpected keyword argument 'force'
Published: May 17, 2016 - 4:32 PM
by Floflobel
Good morning,
I modified all my packages to improve them and I'm encountering this error on quite a few machines:
Code: Select all
need_install() got an unexpected keyword argument 'force'
I saw on another thread that a patch was available on the git repository. But I confess I didn't understand how to patch it.
I've replaced the correct lines. But do I need to recompile the project? And send the file to all the machines?
Thank you,
Re: need_install() got an unexpected keyword argument 'force'
Published: May 17, 2016 - 11:09 PM
by sfonteneau
I don't think the patch fixes this at first glance.
Could you see the package structure to understand the problem?
Also, what version of the WAPT client is it?
If it's a problem with the new `install_exe_if_needed` and `install_msi_if_needed` functions,
it would mean, if I understand correctly, that the `force` argument provided to the `need_install` command is being misinterpreted:
https://github.com/tranquilit/WAPT/blob ... s.py#L3407
Simon
Re: need_install() got an unexpected keyword argument 'force'
Published: May 18, 2016 - 10:24
by Floflobel
Good morning,
The various clients experiencing this problem are on version 1.3.5.0. If this is not the case, I force the update.
Here is one of the packages with the error:
Code: Select all
# -*- coding: utf-8 -*-
import urllib
from setuphelpers import *
uninstallkey = []
# Name of the software
namesoftware='soft'
# Uninstall register key
# For OS 64bits and Software 32bits version : HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\
# For OS 32 bits or 64bits (and Software 64bits version) : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
ukey='{00000000000000}'
# Version of software
version='3.19'
# Unzip folder define in Winrar
foldertmp='C:\Temp'
# Name of execute file
execfile='soft.exe'
# Insert the silent parameters
silentparameters='/install /silent /norestart'
# Link to download the software
downloadlink='http://repo/exe/soft.exe'
# Name of installation files
downloadfilename='soft.exe'
def install():
print(foldertmp + '\\' + execfile)
if need_install(ukey,min_version=version,force=False):
if isfile(foldertmp + '\\' + execfile):
print('Installation files are already present - Installing ' + namesoftware)
install_exe_if_needed(foldertmp + '\\' + execfile, silentflags=silentparameters, key=ukey, min_version=version, accept_returncodes=[0], timeout=600)
#remove_tree(foldertmp)
else:
print('Download and unzip ' + namesoftware)
os.mkdir(foldertmp)
urllib.urlretrieve (downloadlink, foldertmp + '\\' + execfile)
#wget(downloadlink,downloadfilename)
#run(downloadfilename)
print('Installing ' + namesoftware)
install_exe_if_needed(foldertmp + '\\' + execfile, silentflags=silentparameters, key=ukey, min_version=version, accept_returncodes=[0], timeout=600)
#remove_tree(foldertmp)
else:
print('The software is already installed in this version or newer version')
Error: TypeError: need_install() got an unexpected keyword argument 'force'
I replaced the name and the ukey because it's proprietary software. But the error persists on several packages.
I use install_exe_if_needed & install_msi_if_needed.
Re: need_install() got an unexpected keyword argument 'force'
Published: May 18, 2016 - 11:12
by sfonteneau
I don't know if this will solve your problem, but I would do it more like this:
Code: Select all
import inspect
caller_globals = inspect.stack()[1][0].f_globals
WAPT = caller_globals.get('WAPT',None)
force = WAPT and WAPT.options.force
if need_install(ukey,min_version=version,force=force):
This allows the --force option to work for your package (I'm using the setuphelper example again) here:
https://github.com/tranquilit/WAPT/blob ... s.py#L3351
Simon
Re: need_install() got an unexpected keyword argument 'force'
Published: May 18, 2016 - 11:44
by Floflobel
Code: Select all
install_exe_if_needed(foldertmp + '\\' + execfile, silentflags=silentparameters, key=ukey, min_version=version, accept_returncodes=[0], timeout=600, force=force)
So I just add force=force? And I don't change anything else?
Or should I use need_install?
Sincerely,
Re: need_install() got an unexpected keyword argument 'force'
Published: May 18, 2016 - 12:03
by sfonteneau
More like this:
Code: Select all
# -*- coding: utf-8 -*-
import urllib
from setuphelpers import *
uninstallkey = []
# Name of the software
namesoftware='soft'
# Uninstall register key
# For OS 64bits and Software 32bits version : HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\
# For OS 32 bits or 64bits (and Software 64bits version) : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
ukey='{00000000000000}'
# Version of software
version='3.19'
# Unzip folder define in Winrar
foldertmp='C:\Temp'
# Name of execute file
execfile='soft.exe'
# Insert the silent parameters
silentparameters='/install /silent /norestart'
# Link to download the software
downloadlink='http://repo/exe/soft.exe'
# Name of installation files
downloadfilename='soft.exe'
def install():
print(foldertmp + '\\' + execfile)
import inspect
caller_globals = inspect.stack()[1][0].f_globals
WAPT = caller_globals.get('WAPT',None)
force = WAPT and WAPT.options.force
if need_install(ukey,min_version=version,force=force):
if isfile(foldertmp + '\\' + execfile):
print('Installation files are already present - Installing ' + namesoftware)
install_exe_if_needed(foldertmp + '\\' + execfile, silentflags=silentparameters, key=ukey, min_version=version, accept_returncodes=[0], timeout=600)
#remove_tree(foldertmp)
else:
print('Download and unzip ' + namesoftware)
os.mkdir(foldertmp)
urllib.urlretrieve (downloadlink, foldertmp + '\\' + execfile)
#wget(downloadlink,downloadfilename)
#run(downloadfilename)
print('Installing ' + namesoftware)
install_exe_if_needed(foldertmp + '\\' + execfile, silentflags=silentparameters, key=ukey, min_version=version, accept_returncodes=[0], timeout=600)
#remove_tree(foldertmp)
else:
print('The software is already installed in this version or newer version')
I have serious doubts that this is it, but anyway...
Re: need_install() got an unexpected keyword argument 'force'
Published: May 18, 2016 - 12:26
by Floflobel
I just ran the test and nothing changed with these extra lines.
I'm afraid we'll have to wait for someone from the development team to get back to us.
Anyway, thanks for your help.
Re: need_install() got an unexpected keyword argument 'force'
Published: May 18, 2016 - 1:14 PM
by sfonteneau
Hmm, yes, sorry, I don't see the problem.
Does it happen on all of them?
Was it installed via the service or command line?
Re: need_install() got an unexpected keyword argument 'force'
Published: May 18, 2016 - 4:13 PM
by Floflobel
This happens randomly... on packages with the same structure.
Not all machines are affected, but it's likely to happen gradually.
Installation is via WAPT-EXIT, so thanks to the agent.
Do you know how I can contact a developer?
Re: need_install() got an unexpected keyword argument 'force'
Published: May 18, 2016 - 5:07 PM
by sfonteneau
They usually post here regularly or on the mailing list.
Otherwise, you can submit a support ticket directly to them.
I think I understand your problem.
The error message says that the `need_install` function doesn't understand why you're passing it the `force` parameter.
I'm almost certain your client is version 1.2.3.3 (or lower).
Here's the `need_install` function in version 1.2.3.3:
https://github.com/tranquilit/WAPT/blob ... s.py#L3002
And in the latest version:
https://github.com/tranquilit/WAPT/blob ... s.py#L3116
You should check on the WAPT client (on the machine that isn't working) if the `need_install` function in the setuphelper looks like what I sent you above.
Sometimes WAPT client updates don't work properly; the package appears as installed, but the WAPT client isn't the latest version.
Let me know, but I'm almost certain that's the issue.
Simon