From 4f303e668e43ad7f21c796f6069458a71af088b2 Mon Sep 17 00:00:00 2001 From: inpos Date: Wed, 1 Mar 2017 20:45:17 +0300 Subject: [PATCH] python3 agi stderr --- asterisk/agi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/asterisk/agi.py b/asterisk/agi.py index e2da50f..67519bd 100755 --- a/asterisk/agi.py +++ b/asterisk/agi.py @@ -27,6 +27,7 @@ import sys import pprint import re import signal +from six import PY3 DEFAULT_TIMEOUT = 2000 # 2sec timeout used as default for functions that take timeouts DEFAULT_RECORD = 20000 # 20sec record time @@ -103,7 +104,10 @@ class AGI: def _get_agi_env(self): while 1: - line = self.stdin.readline().strip() + if PY3: + line = self.stdin.readline().strip().decode('utf8') + else: + line = self.stdin.readline().strip() self.stderr.write('ENV LINE: ') self.stderr.write(line) self.stderr.write('\n')