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

Python • Re: list/dict error - not understanding

$
0
0
The scope of this project is to take temperature readings from the arduino (which is controlling much more than just temps btw), insert them into the assigned database,
I take it you've seen this posting for MariaDB with Python https://mariadb.com/resources/blog/how- ... o-mariadb/.

I suspect that you are not matching the data type from the Python with MariaDB support data types. See https://mariadb.com/kb/en/data-types/. Unless stated for MariaDB, will not be any coversion.

I could figure out where some of the values were coming from in the code nor did you provide the schema of the DB. Here's an example I hope illustrates taking the Python data and converting it to something to write to the DB

Code:

>>> t=['HotFluidTemp', ' 69.12']>>> type(t)<class 'list'>>>> x=t[1]>>> x' 69.12'>>> type(x)<class 'str'>>>> y=float(x)>>> y69.12>>> type(y)<class 'float'>>>> 

Statistics: Posted by DS256 — Tue Apr 16, 2024 9:03 pm



Viewing all articles
Browse latest Browse all 5592

Trending Articles