Browse Source

Fix byte-string string issues

self.conn.read_until() needs a byte-string object, decode in utf-8 needed for'Local-remote-god user check' section
Matteo Bonamassa 4 years ago
parent
commit
f3fec39ebf
1 changed files with 4 additions and 4 deletions
  1. 4 4
      whoall

+ 4 - 4
whoall

@@ -115,7 +115,7 @@ class Node(Thread):
         # Read data
         lista=''
         reachable=0
-        try: lista = self.conn.read_until("EOF",1)
+        try: lista = self.conn.read_until(b"EOF",1)
         except EOFError: reachable=1
         del self.conn
 
@@ -130,7 +130,7 @@ class Node(Thread):
 
         # Local-remote-god user check
         for x in righe:
-            fields = x.split()
+            fields = x.decode('utf-8').split()
 
             if "tty" in fields[1]:
                 if fields[0] in gods:
@@ -396,7 +396,7 @@ if len(cudanodes):
 
 # Some final output
 if progressbar > 0:
-    print("\n")
+    print("")
     print('Legenda: ' + green + 'utente locale '+ normal \
           + blue + 'utente remoto ' + normal + red + 'admin locale ' + normal \
           + pink + 'admin remoto ' + normal + turquoise + 'nirvana' + normal)
@@ -405,7 +405,7 @@ if progressbar > 0:
     if args.math:
         print("         I nodi contrassegnati con [M4] hanno Mathematica 4.0")
         print("         I nodi contrassegnati con [M5] hanno Mathematica 5.2")
-    print("\n")
+    print("")
 
 # Only in full mode
 if args.full or args.math or args.cuda: