diff speedcheck.py @ 35:815e6b61d76e

Decode to string to work with Python 3.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 14 Nov 2020 15:05:07 +1030
parents 1af6865189ce
children 1a87c79cf103
line wrap: on
line diff
--- a/speedcheck.py	Sat Nov 14 15:02:55 2020 +1030
+++ b/speedcheck.py	Sat Nov 14 15:05:07 2020 +1030
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 
 import configparser
 import optparse
@@ -76,7 +76,7 @@
 def testping(host):
     p = subprocess.Popen(['ping', '-c', '5', '-t', '8', '-q', host], stdout = subprocess.PIPE)
     stdout, stderr = p.communicate()
-    l = stdout.split('\n')
+    l = stdout.decode('ascii', 'ignore').split('\n')
     if len(l) != 6:
         print('Unable to parse ping line:', l)
     xx, xx, xx, plossline, latline, xx = l