rflog_db.py - issues

Skip to first unread message

paul arthur

Sep 26, 2023, 9:52:42 PMSep 26
to PrivateEyePi

While trying to follow this tutorial i had a few issues when executing the script rflog_db.py. The error code i'm receiving is

pi@mopi:~/projects $ /usr/bin/python3 /home/pi/projects/Data-logging/rflog_db.py
An exception of type TypeError occurred. Arguments:
('can only concatenate str (not "bytes") to str',)
can only concatenate str (not "bytes") to str

The sensors are working. Please see the result of serial_mon.py below:

JemRF Serial Monitor 2.3.0

Press ctrl-c to exit


Wed Sep 27 02:04:34 2023 43 AWAKE----

Wed Sep 27 02:04:34 2023 43 TMPA22.19

Wed Sep 27 02:04:34 2023 43 SLEEPING-

Wed Sep 27 02:05:58 2023 84 TMPA22.05

Wed Sep 27 02:05:58 2023 84 SLEEPING-

Wed Sep 27 02:09:46 2023 43 AWAKE----

Wed Sep 27 02:09:46 2023 43 TMPA21.60

Wed Sep 27 02:09:46 2023 43 SLEEPING-

Any ideas as to why this is happening?

Thank you,



Oct 1, 2023, 7:52:45 PMOct 1
to PrivateEyePi

I figured it out. The problem was in the rf2serial.py file. here it's trying to concatenate received data (ser.read()) to the llapMsg variable. In Python 3, you need to make sure that you are working consistently with either bytes or strings. The problem was the following line of code: 

llapMsg += ser.read()

I changed to the following:

llapMsg += ser.read().decode(‘utf-8’, ‘ignore’)

Hopefully this helps somebody else. I tested the db and it is storing the data. 

Kind Regards,


Glenn Seaton

Oct 1, 2023, 7:55:17 PMOct 1
to PrivateEyePi
Thank You Paul!!!!
I had started looking but with no luck so far. This was a great help!
I will update the master download files.


Glenn Seaton

Oct 3, 2023, 11:28:44 AMOct 3
to PrivateEyePi
The Git download has been updated.
I updated the fix to support BME devices that send binary messages that Python decodes into values.
I also updated the Button and State functions to log into the database.
The rflog_db.py current version is 3.10.
I updated the screen sample display to space columns.
The rf2serial.py and rflog_db.py apps in the Python3 folder were changed.
The two .PHP apps index.php and dblogger.php were updated.



Oct 3, 2023, 9:38:18 PMOct 3
to PrivateEyePi
Oh wow, awesome! Looks like you made the entire code base more robust.


Reply all
Reply to author
0 new messages