diff --git a/tsshbatch.py b/tsshbatch.py
index d552ef5..386c3d5 100755
--- a/tsshbatch.py
+++ b/tsshbatch.py
@@ -53,7 +53,7 @@
 #####
 
 import collections
-import commands
+import subprocess
 import getopt
 import getpass
 import os
@@ -305,7 +305,7 @@
 
     try:
         origcmd = cmd
-        status, cmd = commands.getstatusoutput(cmd.strip())
+        status, cmd = subprocess.getstatusoutput(cmd.strip())
 
         # Blow out if the command failed
 
@@ -919,7 +919,8 @@
 try:
     opts, args = getopt.getopt(OPTIONS, OPTIONSLIST)
 
-except getopt.GetoptError, (errmsg, badarg):
+except getopt.GetoptError as xxx_todo_changeme:
+    (errmsg, badarg) = xxx_todo_changeme.args
     ErrorExit(eBADARG % errmsg)
 
 for opt, val in opts:
@@ -1116,7 +1117,7 @@
 if PROMPTUSERNAME:
 
     current_user = UNAME
-    UNAME = raw_input(pUSER %current_user)
+    UNAME = input(pUSER %current_user)
     if not UNAME:                 # User just hit return - wants default
         UNAME = current_user
 
@@ -1193,7 +1194,7 @@
 
     # Unroll and format dictionary structures
 
-    symbols = GlobalSymbolTable.keys()
+    symbols = list(GlobalSymbolTable.keys())
     symbols.sort()
     for symbol in symbols:
         symtbl.append(symbol + (PADWIDTH - len(symbol)) * " "+ SEPARATOR + GlobalSymbolTable[symbol])