TypeError in dallas.py

44 views
Skip to first unread message

iko...@gmail.com

unread,
Mar 29, 2022, 4:33:47 PM3/29/22
to PrivateEyePi
Hi All -

My long term temp reporting station has quite working with the recent upgrade.

As a result, I've upgraded my Raspberry Pi to Jessie, thus converted to Python3.  I seem to be getting error in dallas.py module.

When I run sudo python3 dallas.py

I get the following output: 

An exception of type TypeError occurred. Arguments:
("argument should be integer or bytes-like object, not 'str'",)
argument should be integer or bytes-like object, not 'str'

I can't figure out where the issue is as I'm using the upgrade Python3 dallas.py file.

Any ideas?

Thanks

DG

Glenn Seaton

unread,
Mar 29, 2022, 5:13:32 PM3/29/22
to PrivateEyePi
Did you download the python3 version of the apps?
The dallas.py was upgraded to work under python3.
 
Jessie still has Python 2.7 which should still be on your system as the default when you enter python.
If you did not get the python3 version, dallas.py version 2 should still work with the "python dallas.py" command like you had been doing.


iko...@gmail.com

unread,
Mar 30, 2022, 11:22:46 AM3/30/22
to PrivateEyePi
I just did a fresh install of Raspbian/Buster on a new card. Followed the instructions exactly for Python 3. And am still getting this when I run sudo python3 dallas.py:

An exception of type TypeError occurred. Arguments:
("argument should be integer or bytes-like object, not 'str'",)
argument should be integer or bytes-like object, not 'str'

There are some Traceback tricks you can put in the Python file to get more robust error reporting and it seems to point to issues in alarmfunctionsr.py

Has anyone did a fresh install of Raspberry PI OS with Python3, using  a DS18b20 and had success?

Thanks!

Chris B

unread,
Mar 31, 2022, 12:50:27 PM3/31/22
to PrivateEyePi
I suffered from a long running monitor failing back in January following server upgrades. 

Following advice here it was discovered that I was still running jessie but

 I used this reference
 

to upgrade from jessie to stretch
and then followed the link in that page to update from stretch to buster.
 
System is now all working fine but the command sudo python reveals that I am still running python 2.7.13.

So I am running Buster, but not from a clean install.

iko...@gmail.com

unread,
Mar 31, 2022, 11:58:58 PM3/31/22
to PrivateEyePi
I ended up loading up Buster and using Python2 - ver 2.7.16.  Reinstalled following the scattered instructions and got it working again.  I did send some tips and a dallas.py file to Glenn to see if he truly does have PEP running with Python3. 

Glenn Seaton

unread,
Apr 2, 2022, 12:19:58 AM4/2/22
to PrivateEyePi
I found the problem.  The string split function under Python 2 did not care if the string to split was empty.  It returned a blank result.
The same String Split function under Python 3, if the string is empty, processes it as a bad format and fails.
I have added checks in the alarmfunctions.py code, to test for empty and continue working.
The current alarmfunctions.py for Python 3 is now Version 15.00.
I tested the dallas.py application. It reads my hardwired sensor under python 3 and sends reading to the server.
The updated  pep_python3.zip is online and can be downloaded.

Glenn
Reply all
Reply to author
Forward
0 new messages