mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-28 19:06:19 -05:00
Moving size check into try/except to catch FileNotFoundError.
This commit is contained in:
parent
d6769c4922
commit
90d3b8ca65
1 changed files with 3 additions and 3 deletions
|
|
@ -84,10 +84,10 @@ async def take_screenshot(url: str) -> bytes:
|
|||
logger.error(f'Failed to screenshot {url}', exc_info=True)
|
||||
return b''
|
||||
|
||||
path = f'{tmp_dir}/screenshot.png'
|
||||
size = os.path.getsize(path)
|
||||
logger.info(f'Successful screenshot ({size} bytes) at {path}')
|
||||
try:
|
||||
path = f'{tmp_dir}/screenshot.png'
|
||||
size = os.path.getsize(path)
|
||||
logger.info(f'Successful screenshot ({size} bytes) at {path}')
|
||||
with open(path, 'rb') as fh:
|
||||
png = fh.read()
|
||||
return png
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue