From 87d672c72664f89250f08693505e02d0905926a1 Mon Sep 17 00:00:00 2001 From: Shai Berger Date: Wed, 8 Jan 2020 16:59:36 +0200 Subject: [PATCH] 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 --- supervisor_stdout.py | 1 + 1 file changed, 1 insertion(+) diff --git a/supervisor_stdout.py b/supervisor_stdout.py index e7b1b5a..ea70691 100644 --- a/supervisor_stdout.py +++ b/supervisor_stdout.py @@ -18,6 +18,7 @@ def main(): write_stdout('RESULT %s\n%s'%(len(data), data)) # transition from READY to ACKNOWLEDGED def event_handler(event, response): + response = response.decode() line, data = response.split('\n', 1) headers = dict([ x.split(':') for x in line.split() ]) lines = data.split('\n') 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