Convert STDOUT from Popen's to UTF-8 #348

Merged
Yeraze merged 1 commits from Python_Stdout into master 2020-12-16 20:34:31 +00:00
Yeraze commented 2020-10-04 15:27:54 +01:00 (Migrated from github.com)

By default, Python3's STDOUT's that come back from Popen commands
are byte-arrays, not strings. So attempting to do string operations
(like 'split' or 'strip') fail. They must be converted to UTF-8
strings first.

This was causing the enclosure plugin to return false debug messages about
'disabling SUDO' when attempting to read my DHT22 sensor.

By default, Python3's STDOUT's that come back from Popen commands are byte-arrays, not strings. So attempting to do string operations (like 'split' or 'strip') fail. They must be converted to UTF-8 strings first. This was causing the enclosure plugin to return false debug messages about 'disabling SUDO' when attempting to read my DHT22 sensor.
M0o0P commented 2020-11-19 04:33:55 +00:00 (Migrated from github.com)

Thanks @Yeraze , I was able to get my DHT22 running after upgrading to Python 3. One note is that the logging may have issues, Have you noticed any problems with the Enc Plug temp logging?

Thanks @Yeraze , I was able to get my DHT22 running after upgrading to Python 3. One note is that the logging may have issues, Have you noticed any problems with the Enc Plug temp logging?
Yeraze commented 2020-11-19 13:52:03 +00:00 (Migrated from github.com)

None so far.. Been running it since I created this PR, seems to be working great.

None so far.. Been running it since I created this PR, seems to be working great.
vitormhenrique commented 2020-12-16 20:34:28 +00:00 (Migrated from github.com)

looks like there is no conflict with python 2, so i'll merge while i don't finish 3.x version

looks like there is no conflict with python 2, so i'll merge while i don't finish 3.x version
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#348