macOS: TypeError: _log() got an unexpected keyword argument 'file'

Share your tips or issues concerning the WAPT Console or WAPT Agent here
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
marcolefo
Messages: 27
Registration: Oct 02, 2018 - 11:13

June 25, 2020 - 8:07 PM

Good morning,

I am testing the installation of agent 1.8.2.7265 under macOS 10.15.5

It crashes during registration. I imagine it's a Python version issue. I'm posting here in case it helps.
But if it can be resolved, I'm all for it ;)

Good evening

Code: Select all

# python --version 
Python 2.7.16
# wapt-get register -l debug
2020-06-25 19:55:22,220 DEBUG Default encoding : ascii 
2020-06-25 19:55:22,220 DEBUG Setting encoding for stdout and stderr to UTF-8 
2020-06-25 19:55:22,220 DEBUG Python path ['/opt/wapt', '/opt/wapt', '/opt/wapt/lib/python27.zip', '/opt/wapt/lib/python2.7', '/opt/wapt/lib/python2.7/plat-darwin', '/opt/wapt/lib/python2.7/plat-mac', '/opt/wapt/lib/python2.7/plat-mac/lib-scriptpackages', '/opt/wapt/lib/python2.7/lib-tk', '/opt/wapt/lib/python2.7/lib-old', '/opt/wapt/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/opt/wapt/lib/python2.7/site-packages']
2020-06-25 19:55:22,220 INFO Using local waptservice configuration /opt/wapt/wapt-get.ini 
2020-06-25 19:55:22,220 DEBUG Config file: /opt/wapt/wapt-get.ini
Using config file: /opt/wapt/wapt-get.ini
2020-06-25 19:55:22,224 DEBUG Thread 4514852288 is connecting to wapt db
2020-06-25 19:55:22,228 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:22,253 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:22,256 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:22,392 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:22,421 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:22,448 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:22,450 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:22,585 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:22,589 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:22,625 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:22,626 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:22,755 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:22,760 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:22,784 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:22,786 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:22,918 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:22,920 DEBUG Using host certificate /opt/wapt/private/A35C8C6C-FDCE-5F1F-BDF6-E83297815CB9.pem for repo global auth
2020-06-25 19:55:22,922 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:22,945 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:22,946 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:23,074 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:23,078 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:23,100 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:23,101 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:23,234 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:23,237 DEBUG Thread 4514852288 is connecting to wapt db
2020-06-25 19:55:23,237 DEBUG DB Start transaction
2020-06-25 19:55:23,238 DEBUG DB commit
2020-06-25 19:55:23,242 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:23,263 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:23,264 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:23,447 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:23,452 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:23,474 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:23,478 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:23,614 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:23,619 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:23,644 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:23,646 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:23,775 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:23,780 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:23,803 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:23,804 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:23,939 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:23,942 DEBUG Using host certificate /opt/wapt/private/A35C8C6C-FDCE-5F1F-BDF6-E83297815CB9.pem for repo wapt auth
2020-06-25 19:55:23,943 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:23,966 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:23,967 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:24,104 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:24,109 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:24,131 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:24,132 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:24,265 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:24,268 INFO Main repository: https://wapt.domain/wapt
2020-06-25 19:55:24,271 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:24,295 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:24,297 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:24,426 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:24,429 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:24,450 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:24,452 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:24,587 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:24,593 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:24,614 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:24,615 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:24,743 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:24,747 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:24,770 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:24,772 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:24,904 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:24,908 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:24,932 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:24,934 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:25,064 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:25,069 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:25,092 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:25,094 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:25,224 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:25,226 DEBUG Using host certificate /opt/wapt/private/A35C8C6C-FDCE-5F1F-BDF6-E83297815CB9.pem for repo wapt-host auth
2020-06-25 19:55:25,228 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:25,251 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:25,252 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:25,382 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:25,386 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:25,410 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:25,411 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:25,535 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:25,538 INFO User Groups:[]
2020-06-25 19:55:25,538 DEBUG WAPT base directory : /opt/wapt
2020-06-25 19:55:25,538 DEBUG Package cache dir : /opt/wapt/cache
2020-06-25 19:55:25,538 DEBUG WAPT DB Structure version;: 20200415
Registering host against server: https://wapt.domain/
2020-06-25 19:55:25,538 DEBUG DB Start transaction
2020-06-25 19:55:25,539 DEBUG DB commit
2020-06-25 19:55:25,545 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:25,571 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:25,572 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:25,707 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:25,709 DEBUG DB Start transaction
2020-06-25 19:55:25,709 DEBUG DB commit
2020-06-25 19:55:25,711 DEBUG DB Start transaction
2020-06-25 19:55:25,711 DEBUG DB commit
2020-06-25 19:55:25,724 INFO Run "route get default"
2020-06-25 19:55:25,738 INFO route get default command returns code 0
2020-06-25 19:55:26,885 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:26,911 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:26,912 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:27,042 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:27,045 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:27,175 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:27,246 DEBUG DB Start transaction
2020-06-25 19:55:27,250 DEBUG DB commit
2020-06-25 19:55:27,253 DEBUG Stores cert chain check in cache
2020-06-25 19:55:27,257 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:27,281 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:27,282 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:27,413 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:27,420 INFO Run "dmidecode -q 2>/dev/null"
2020-06-25 19:55:27,443 INFO dmidecode -q 2>/dev/null command returns code 0
2020-06-25 19:55:27,444 INFO Run "system_profiler SPHardwareDataType -xml"
2020-06-25 19:55:27,579 INFO system_profiler SPHardwareDataType -xml command returns code 0
2020-06-25 19:55:27,585 INFO Run "file /Applications/VLC.app/Contents/Info.plist"
2020-06-25 19:55:27,600 INFO file /Applications/VLC.app/Contents/Info.plist command returns code 0
2020-06-25 19:55:27,630 INFO Run "file /Applications/nextcloud.app/Contents/Info.plist"
2020-06-25 19:55:27,653 INFO file /Applications/nextcloud.app/Contents/Info.plist command returns code 0
FATAL ERROR : TypeError: _log() got an unexpected keyword argument 'file'
Traceback (most recent call last):
  File "/opt/wapt//wapt-get.py", line 1462, in <module>
    main()
  File "/opt/wapt//wapt-get.py", line 1241, in main
    description=(" ".join(args[1:])).decode(sys.getfilesystemencoding()),
  File "/opt/wapt/common.py", line 5621, in register_computer
    inv = self._get_host_status_data(old_hashes, new_hashes, force=True, include_dmi=True, include_wmi=True)
  File "/opt/wapt/common.py", line 5945, in _get_host_status_data
    _add_data_if_updated(inv,'installed_softwares',self.merge_installed_softwares_and_wua_list(),old_hashes,new_hashes)
  File "/opt/wapt/common.py", line 6110, in merge_installed_softwares_and_wua_list
    soft_inventory = setuphelpers.installed_softwares()
  File "/opt/wapt/setuphelpers_macos.py", line 433, in installed_softwares
    logger.warning("Application data acquisition failed for {} :".format(plist_file), file=sys.stderr)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1186, in warning
    self._log(WARNING, msg, args, **kwargs)
TypeError: _log() got an unexpected keyword argument 'file'
WAPT Enterprise Server: 2.6.0.17343 / Server OS: Debian bookworm /
Administration/package creation machine OS: macOS 15
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

June 25, 2020 - 10:20 PM

seems to be a problem during the inventory process with the Nextcloud application (I'm not certain).

We need to use a try-except block during the inventory to prevent it from crashing.

I'm going to install Nextcloud on the Mac to see if that's the issue,

Simon.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

June 25, 2020 - 10:48 PM

Indeed, the code needs a small patch:

In the file /opt/wapt/setuphelpers_macos.py, line 433

Code: Select all

else:
            #logger.warning("Application data acquisition failed for {} :".format(plist_file), file=sys.stderr)
            logger.warning("Application data acquisition failed for {} :".format(plist_file))
The Nextcloud application apparently does not have a CFBundleName
https://developer.apple.com/documentati ...bundlename
MisterP
Messages: 6
Registration: May 28, 2020 - 12:10

July 2, 2020 - 3:13 PM

Hello,

I'm indeed experiencing the same problem; modifying the line fixes it.
Do you have a version that includes the fix directly?


Thank you.
Locked