Unrecognised 'magic number' %02x %02x

26 views
Skip to first unread message

Mark Fraser

unread,
May 16, 2021, 10:52:47 AM5/16/21
to py...@googlegroups.com
Any idea what could be causing this?
May 16 13:00:33 Weather pywws-livelog[25003]: Traceback (most recent
call last):
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/lib/python3.7/logging/__init__.py", line 1034, in emit
May 16 13:00:33 Weather pywws-livelog[25003]: msg = self.format(record)
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/lib/python3.7/logging/__init__.py", line 880, in format
May 16 13:00:33 Weather pywws-livelog[25003]: return fmt.format(record)
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/local/lib/python3.7/dist-packages/pywws/logger.py", line 36, in format
May 16 13:00:33 Weather pywws-livelog[25003]: level,
super(SystemdFormatter, self).format(record))
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/lib/python3.7/logging/__init__.py", line 619, in format
May 16 13:00:33 Weather pywws-livelog[25003]: record.message =
record.getMessage()
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/lib/python3.7/logging/__init__.py", line 380, in getMessage
May 16 13:00:33 Weather pywws-livelog[25003]: msg = msg % self.args
May 16 13:00:33 Weather pywws-livelog[25003]: TypeError: %x format: an
integer is required, not NoneType
May 16 13:00:33 Weather pywws-livelog[25003]: Call stack:
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/local/bin/pywws-livelog", line 8, in <module>
May 16 13:00:33 Weather pywws-livelog[25003]: sys.exit(main())
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/local/lib/python3.7/dist-packages/pywws/livelog.py", line 130, in main
May 16 13:00:33 Weather pywws-livelog[25003]: return live_log(args[0])
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/local/lib/python3.7/dist-packages/pywws/livelog.py", line 84, in
live_log
May 16 13:00:33 Weather pywws-livelog[25003]: logged_only=(not
tasks.has_live_tasks())):
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/local/lib/python3.7/dist-packages/pywws/logdata.py", line 268, in
live_data
May 16 13:00:33 Weather pywws-livelog[25003]: self.check_fixed_block()
May 16 13:00:33 Weather pywws-livelog[25003]: File
"/usr/local/lib/python3.7/dist-packages/pywws/logdata.py", line 123, in
check_fixed_block
May 16 13:00:33 Weather pywws-livelog[25003]:
self.fixed_block['magic_1'])
May 16 13:00:33 Weather pywws-livelog[25003]: Message: "Unrecognised
'magic number' %02x %02x"
May 16 13:00:33 Weather pywws-livelog[25003]: Arguments: (118, None)

Jim Easterbrook

unread,
May 16, 2021, 1:04:03 PM5/16/21
to py...@googlegroups.com
On 16/05/2021 15:52, Mark Fraser wrote:
> Any idea what could be causing this?

> May 16 13:00:33 Weather pywws-livelog[25003]:   File
> "/usr/local/lib/python3.7/dist-packages/pywws/logdata.py", line 123, in
> check_fixed_block
> May 16 13:00:33 Weather pywws-livelog[25003]: self.fixed_block['magic_1'])
> May 16 13:00:33 Weather pywws-livelog[25003]: Message: "Unrecognised
> 'magic number' %02x %02x"
> May 16 13:00:33 Weather pywws-livelog[25003]: Arguments: (118, None)

pywws is attempting to tell you that the first two bytes of the "fixed
block" data are not the usual values. This usually indicates some
incorrect memory writing in the weather station, which might be a sign
of a developing fault.

Unfortunately one of the values is being decoded as "None" (stored in
the station as all 1s) so the message formatting doesn't work and causes
the stack trace you're getting.

I really should have foreseen this problem, but we've gone a long time
before anyone reported it. I'll sort it out before the next release. In
the meantime, doing a power off reset of your station might fix it.
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>
Reply all
Reply to author
Forward
0 new messages