Getting /dev/null from os.devnull rather than subprocess.DEVNULL, which does not exist in python 2.7; also checking that we have data in the PPTable before asking for the max length of that data
switching to sys.stdout.write and sys.stdout.flush for compatibility with python 2; looking for the correct file-not-found error in python 2