summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPhilipp Hahn <hahn@univention.de>2020-04-27 14:32:09 +0200
committerPhilipp Hahn <pmhahn+github@pmhahn.de>2020-08-05 07:43:01 +0000
commit900676d3c45464041a2d609f806ae1899f2b3aad (patch)
tree14e06421263619037ae2b1c186afcd75f2c4f628 /examples
parent55415a48703b9ca79c71e2cdbace9f9604f95d87 (diff)
downloadlibvirt-python-900676d3c45464041a2d609f806ae1899f2b3aad.tar.gz
examples/consolecallback: Fix assorted errors
Assert stream is opened before receiving bytes. Need to check for bytes() instead of [unicode]str(). Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'examples')
-rw-r--r--examples/consolecallback.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/consolecallback.py b/examples/consolecallback.py
index 3e0cac4..950e312 100644
--- a/examples/consolecallback.py
+++ b/examples/consolecallback.py
@@ -43,7 +43,7 @@ def check_console(console):
def stdin_callback(watch, fd, events, console):
readbuf = os.read(fd, 1024)
- if readbuf.startswith(""):
+ if readbuf.startswith(b""):
console.run_console = False
return
if console.stream:
@@ -51,6 +51,7 @@ def stdin_callback(watch, fd, events, console):
def stream_callback(stream, events, console):
try:
+ assert console.stream
received_data = console.stream.recv(1024)
except:
return