I wrote a script that reads a .cnf file, analyses some stuff and then outputs some results (via print()
). For reading the .cnf file, I use the following line:
with open('config.cnf') as f:
file_content = f.read()
Now if I run this in the Spyder-Environment (Python 3.6), everything works fine. The scripts read config.cnf, does the operations and outputs the results. If I run the exact same script on Linux (with the config.cnf located in the same Directory), the following error message is shown:
Traceback (most recent call last):
File "Conf2Monit_V2.py", line 45, in <module>
file_content = f.read()
File "/usr/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in Position 29834: invalid start byte
I use the following command:
python3 myScript.py
I am new to Python AND to Linux, so please don't be fed up if this is some basic mistake. Thank you.