diff --git a/esptool/util.py b/esptool/util.py index 91e4ee16b..ecd41c0d9 100644 --- a/esptool/util.py +++ b/esptool/util.py @@ -68,7 +68,7 @@ def print_overwrite(message, last_line=False): If output is not a TTY (for example redirected a pipe), no overwriting happens and this function is the same as print(). """ - if sys.stdout.isatty(): + if hasattr(sys.stdout, "isatty") and sys.stdout.isatty(): print("\r%s" % message, end="\n" if last_line else "") else: print(message)