Removes debug prints
Catches os.stat() raising OSError
Restores Python 3 compatibility