Compare commits

..

2 Commits

Author SHA1 Message Date
mihalycsaba 304ff6a470
Merge 9babbb28d7 into 76bea74a08 2024-10-07 14:58:46 +02:00
Ryein Goddard 76bea74a08
Handle situations where terminalsize cannot be found 2024-10-07 13:59:49 +05:30
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