Index: misc/autosavesit.py
===================================================================
--- misc/autosavesit.py	(revision 88)
+++ misc/autosavesit.py	(revision 97)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Program to automatically save the situation at certain intervals
@@ -24,5 +24,5 @@
     xplane = XPlane()
 
-    print "Connecting to X-Plane..."
+    print("Connecting to X-Plane...")
 
     while not xplane.isConnected:
@@ -30,8 +30,8 @@
             xplane.connect()
         except:
-            print "Connection failed, sleeping..."
+            print("Connection failed, sleeping...")
             time.sleep(0.5)
 
-    print "Connected to X-Plane"
+    print("Connected to X-Plane")
 
     try:
@@ -44,12 +44,12 @@
                     os.rename(newPath, path)
 
-                    print "Situation saved at " + time.strftime("%H:%M:%S")
-                except OSError, e:
-                    print "I/O error occured: " + str(e)
-            except ProtocolException, e:
-                print "Protocol error occured: " + str(e)
+                    print("Situation saved at " + time.strftime("%H:%M:%S"))
+                except OSError as e:
+                    print("I/O error occured: " + str(e))
+            except ProtocolException as e:
+                print("Protocol error occured: " + str(e))
             time.sleep(interval)
-    except Exception, e:
-        print "Connection failed: " + str(e)
+    except Exception as e:
+        print("Connection failed: " + str(e))
         try:
             xplane.disconnect()
Index: misc/client.py
===================================================================
--- misc/client.py	(revision 45)
+++ misc/client.py	(revision 97)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import sys
@@ -54,5 +54,5 @@
         - the remainder of the argument list."""
         if len(words)<2:
-            print >> sys.stderr, "Missing parameters"
+            print("Missing parameters", file=sys.stderr)
             return None
 
@@ -62,5 +62,5 @@
         type = words[1]
         if type not in CLI._types:
-            print >> sys.stderr, "Invalid type"
+            print("Invalid type", file=sys.stderr)
             return None
 
@@ -69,5 +69,5 @@
         if type in ["ia", "fa", "ba", "s"]:
             if len(words)<4:
-                print >> sys.stderr, "Missing parameters"
+                print("Missing parameters", file=sys.stderr)
                 return None
             length = int(words[2])
@@ -80,5 +80,5 @@
     def _packLength(x):
         """Pack the given integer as a variable-length value."""
-        s = ""
+        s = bytes()
         while True:
             y = x&0x7f
@@ -92,5 +92,5 @@
     def _packString(s):
         """Pack the given string."""
-        return CLI._packLength(len(s)) + s
+        return CLI._packLength(len(s)) + bytes(s, "utf-8")
 
     def __init__(self, stream):
@@ -111,5 +111,5 @@
         """Handle uhandled commands"""
         if line=="EOF":
-            print
+            print()
             return True
         else:
@@ -135,7 +135,7 @@
         result = self._readU8()
         if result==0:
-            print self._readValue(type)
+            print(self._readValue(type))
         else:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_set(self, args):
@@ -143,5 +143,5 @@
         words = self._splitArgs(args)
         if len(words)<3:
-            print >> sys.stderr, "Missing parameters"
+            print("Missing parameters", file=sys.stderr)
             return False
 
@@ -150,5 +150,5 @@
         type = words[1]
         if type not in self._types:
-            print >> sys.stderr, "Invalid type"
+            print("Invalid type", file=sys.stderr)
             return False
 
@@ -173,5 +173,5 @@
         result = self._readU8()
         if result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_multiget(self, args):
@@ -204,10 +204,10 @@
             for (_, type, _, _) in specs:
                 value = self._readValue(type)
-                print value
+                print(value)
         elif result==0x02:
             index = self._readU32()
-            print >> sys.stderr, "Invalid dataref at #%d" % (index,)
+            print("Invalid dataref at #%d" % (index,), file=sys.stderr)
         else:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_multiset(self, args):
@@ -223,5 +223,5 @@
                 words = result[1]
                 if not words:
-                    print >> sys.stderr, "Missing argument"
+                    print("Missing argument", file=sys.stderr)
                     return False
                 specs.append(result[0])
@@ -246,7 +246,7 @@
         if result==0x02:
             index = self._readU32()
-            print >> sys.stderr, "Invalid dataref at #%d" % (index,)
+            print("Invalid dataref at #%d" % (index,), file=sys.stderr)
         elif result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_reg_multiget(self, args):
@@ -280,7 +280,7 @@
             self._multiGets[id] = \
                 [type for (name, type, length, offset) in specs]
-            print "ID:", id
+            print("ID:", id)
         else:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_unreg_multiget(self, args):
@@ -288,5 +288,5 @@
         words = self._splitArgs(args)
         if len(words)<1:
-            print >> sys.stderr, "Missing parameter"
+            print("Missing parameter", file=sys.stderr)
             return False
 
@@ -299,5 +299,5 @@
         result = self._readU8()
         if result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
         if id in self._multiGets:
@@ -308,10 +308,10 @@
         words = self._splitArgs(args)
         if len(words)<1:
-            print >> sys.stderr, "Missing parameter"
+            print("Missing parameter", file=sys.stderr)
             return False
 
         id = int(words[0])
         if id not in self._multiGets:
-            print >> sys.stderr, "Invalid ID"
+            print("Invalid ID", file=sys.stderr)
             return False
 
@@ -324,10 +324,10 @@
             for type in self._multiGets[id]:
                 value = self._readValue(type)
-                print value
+                print(value)
         elif result==0x02:
             index = self._readU32()
-            print >> sys.stderr, "Invalid dataref at #%d" % (index,)
+            print("Invalid dataref at #%d" % (index,), file=sys.stderr)
         else:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_reg_multiset(self, args):
@@ -361,7 +361,7 @@
             self._multiSets[id] = \
                 [(type, length) for (name, type, length, offset) in specs]
-            print "ID:", id
+            print("ID:", id)
         else:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_unreg_multiset(self, args):
@@ -369,5 +369,5 @@
         words = self._splitArgs(args)
         if len(words)<1:
-            print >> sys.stderr, "Missing parameter"
+            print("Missing parameter", file=sys.stderr)
             return False
 
@@ -380,5 +380,5 @@
         result = self._readU8()
         if result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
         if id in self._multiSets:
@@ -389,10 +389,10 @@
         words = self._splitArgs(args)
         if len(words)<1:
-            print >> sys.stderr, "Missing parameter"
+            print("Missing parameter", file=sys.stderr)
             return False
 
         id = int(words[0])
         if id not in self._multiSets:
-            print >> sys.stderr, "Invalid ID"
+            print("Invalid ID", file=sys.stderr)
             return False
 
@@ -400,5 +400,5 @@
         types = self._multiSets[id]
         if len(words)<len(types):
-            print >> sys.stderr, "Missing parameter"
+            print("Missing parameter", file=sys.stderr)
             return False
 
@@ -413,12 +413,12 @@
         if result==0x02:
             index = self._readU32()
-            print >> sys.stderr, "Invalid dataref at #%d" % (index,)
+            print("Invalid dataref at #%d" % (index,), file=sys.stderr)
         elif result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_show_message(self, args):
         words = self._splitArgs(args)
         if len(words)<2:
-            print >> sys.stderr, "Missing parameters"
+            print("Missing parameters", file=sys.stderr)
             return False
 
@@ -433,5 +433,5 @@
         result = self._readU8()
         if result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_reload(self, args):
@@ -441,10 +441,10 @@
         result = self._readU8()
         if result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_register_hotkeys(self, args):
         words = self._splitArgs(args)
         if not words:
-            print >> sys.stderr, "Missing parameters"
+            print("Missing parameters", file=sys.stderr)
             return False
 
@@ -457,5 +457,5 @@
         result = self._readU8()
         if result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_query_hotkeys(self, args):
@@ -469,7 +469,7 @@
             for i in range(0, length):
                 values.append(self._readU8())
-            print values
+            print(values)
         else:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def do_unregister_hotkeys(self, args):
@@ -479,5 +479,5 @@
         result = self._readU8()
         if result!=0:
-            print >> sys.stderr, "Error code:", result
+            print("Error code:", result, file=sys.stderr)
 
     def _writeU8(self, x):
@@ -568,5 +568,5 @@
             length = self._readS32()
             if length>8192:
-                print "Very big length:", length
+                print("Very big length:", length)
                 return None
             elif length>0:
@@ -622,3 +622,3 @@
     s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
     s.connect("/tmp/xplra-" + os.environ["LOGNAME"])
-    CLI(s.makefile()).cmdloop()
+    CLI(s.makefile("rwb")).cmdloop()
