Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3923

Python • Re: CPU Temperature Test Not Working; Need File Format

$
0
0
I tried to use the code on the "Heating and cooling Raspberry Pi 5" page (https://www.raspberrypi.com/news/heatin ... erry-pi-5/) and couldn't get it to work; kept getting this error:

Code:

SyntaxError: Non-UTF-8 code starting with '\xb0' in file /home/<user>/Documents/heatplotter.py on line 10, but no encoding declared; see https://peps.python.org/pep-0263/ for details
I tried going to the python website link, and found out these lines of code were needed:

Code:

#!/usr/bin/python# -*- coding: <encoding name> -*-
This fixed part of the problem, but now I need to know the file type used.

(heatplotter.py is the name of the file with the code in it.)



I don't know the answer to the specific question you pose.

But it seems likely that the problem is caused by the little 'degree' symbol in the fb.write() line that generates a header.

It is only cosmetic. Removing that 'degree' symbol from the fb..write statement will allow the code to run with no other code or configuration changes needed.

Statistics: Posted by B.Goode — Mon Sep 30, 2024 7:38 am



Viewing all articles
Browse latest Browse all 3923

Trending Articles