Updating the RaspberryPiVcgencmd library to Python 3

This post talks quickly about the updates performed to the RaspberryPiVcgencmd library for porting to Python 3.

Porting RaspberryPiVcgencmd to Python 3

Originally this library was written for Python 2 but now that has been retired it was time to update it.

The main work that needed to be done was tweaking the print statements used in the print_all_sensors.py script. This is needed as Python 3 changed how print works by changing it so that it is now a function.

In addition to this since Python 3 handles encoding differently I had to make tweaks to its handling. This involved taking the output of the command as a binary string and encoding it into a text string. Currently I am using UTF-8 to ensure the binary string from and use it in the program.

These small tweaks wont change how the program is used but will allow it to be used with Python 3.

These updates now ready it to be used with the Raspberry Pi Cluster Project so I can log the temperature they reach.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.