mqttwarn: Windows10 - UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Followed steps to install mqttwarn on my W10 machine. Everything seemed to work including mqttwarn make-xxx commands. Finally tried running mqttwarn by itself and got strange error messages. Any help?
pip install --upgrade mqttwarn
mqttwarn make-config > mqttwarn.ini
cat mqttwarn.ini
mqttwarn make-samplefuncs > samplefuncs.py
mqttwarn
Traceback (most recent call last):
File "D:\Program Files (D)\Python37\Scripts\mqttwarn-script.py", line 33, in <module>
sys.exit(load_entry_point('mqttwarn==0.28.1', 'console_scripts', 'mqttwarn')())
File "d:\program files (d)\python37\lib\site-packages\mqttwarn\commands.py", line 93, in run
run_mqttwarn()
File "d:\program files (d)\python37\lib\site-packages\mqttwarn\commands.py", line 132, in run_mqttwarn
config = load_configuration(name=scriptname)
File "d:\program files (d)\python37\lib\site-packages\mqttwarn\configuration.py", line 196, in load_configuration
return Config(configfile, defaults=defaults)
File "d:\program files (d)\python37\lib\site-packages\mqttwarn\configuration.py", line 38, in __init__
self.read_file(f)
File "d:\program files (d)\python37\lib\configparser.py", line 717, in read_file
self._read(f, source)
File "d:\program files (d)\python37\lib\configparser.py", line 1014, in _read
for lineno, line in enumerate(fp, start=1):
File "d:\program files (d)\python37\lib\codecs.py", line 714, in __next__
return next(self.reader)
File "d:\program files (d)\python37\lib\codecs.py", line 645, in __next__
line = self.readline()
File "d:\program files (d)\python37\lib\codecs.py", line 558, in readline
data = self.read(readsize, firstline=True)
File "d:\program files (d)\python37\lib\codecs.py", line 504, in read
newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (7 by maintainers)
I did that with the .py files. I opened them in notepad and immediately did a “save as” choosing utf8 and overwriting the original. Interestingly all the files I had worked with had said they were going to save as utf8 until I got to samplefuncs.py which said it would save as utf16. I changed that to utf8 and…presto! It works!
and mosquitto seemed to react. Now I just need to make some adjustments for my setup and tell it what to do when it gets a message.
Thanks for all your help.
Jim