Skip to content

Commit 87d672c

Browse files
authored
Fix python 3 support
Under Python 3, the `response` argument passed to the `event_handler()` function is a `bytes` instance; before using the data from it in string manipulations and print statements, it needs to be transformed to `str`, because the automatic "cast" includes an initial `b` and quotes around the value. Under Python 2, this is still ok if the logs are all ASCII, but more generally, who cares. Python 2 is dead. This proposal is courtesy of Matific -- see https://www.matific.com
1 parent 87632a7 commit 87d672c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

supervisor_stdout.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def main():
1818
write_stdout('RESULT %s\n%s'%(len(data), data)) # transition from READY to ACKNOWLEDGED
1919

2020
def event_handler(event, response):
21+
response = response.decode()
2122
line, data = response.split('\n', 1)
2223
headers = dict([ x.split(':') for x in line.split() ])
2324
lines = data.split('\n')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy