Update fetch-macOS-v2.py

This commit is contained in:
Ryein Goddard 2024-10-02 09:33:01 -07:00 committed by GitHub
parent ad213b6c80
commit afff5530be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -234,7 +234,10 @@ def save_image(url, sess, filename='', directory=''):
break
fh.write(chunk)
size += len(chunk)
terminalsize = max(os.get_terminal_size().columns - TERMINAL_MARGIN, 0)
try:
terminalsize = max(os.get_terminal_size().columns - TERMINAL_MARGIN, 0)
except OSError:
terminalsize = 80
if oldterminalsize != terminalsize:
print(f'\r{"":<{terminalsize}}', end='')
oldterminalsize = terminalsize