When splitting output from a process under python 3 a 'bytes-like object is required, not str' TypeError is raised (refer trace below). This PR decodes the process output before it is split.
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: Caught unrecoverable exception:
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** a bytes-like object is required, not 'str'
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** Traceback (most recent call last):
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 193, in run
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** self.dispatchEvent(weewx.Event(weewx.CHECK_LOOP, packet=packet))
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 222, in dispatchEvent
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** callback(event)
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 574, in check_loop
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** raise BreakLoop
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** weewx.engine.BreakLoop
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: ****
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** During handling of the above exception, another exception occurred:
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: ****
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** Traceback (most recent call last):
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewxd", line 154, in main
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** engine.run()
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 200, in run
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** self.dispatchEvent(weewx.Event(weewx.POST_LOOP))
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 222, in dispatchEvent
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** callback(event)
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 590, in post_loop
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** self._catchup(self.engine.console.genArchiveRecords)
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 635, in _catchup
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** origin='hardware'))
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 222, in dispatchEvent
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** callback(event)
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/user/cmon.py", line 776, in new_archive_record
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** self.save_data(self.get_data(event.record['dateTime'], self.last_ts))
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/user/cmon.py", line 802, in get_data
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** record = self.collector.get_data(now_ts)
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/user/cmon.py", line 455, in get_data
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** record = super(LinuxCollector, self).get_data(now)
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/user/cmon.py", line 332, in get_data
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** record.update(self._get_apcups_info())
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** File "/home/weewx/bin/user/cmon.py", line 344, in _get_apcups_info
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** for line in o.split('\n'):
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** TypeError: a bytes-like object is required, not 'str'
Feb 18 17:40:16 cockatoo weewx[18775] CRITICAL __main__: **** Exiting.
When splitting output from a process under python 3 a 'bytes-like object is required, not str' TypeError is raised (refer trace below). This PR decodes the process output before it is split.