Skip to content

Commit

Permalink
put screenshot function into try-except block
Browse files Browse the repository at this point in the history
  • Loading branch information
wyrnat committed Dec 14, 2023
1 parent 9fdd2bf commit c774668
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/badger/logbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ def send_to_logbook(routine, data, widget=None):
xmlFile.write(xmlString)
xmlFile.write('\n') # Close with newline so cron job parses correctly
xmlFile.close()
screenshot(widget, f'{fileName}.png')

# take screenshot of GUI if possible
try:
screenshot(widget, f'{fileName}.png')
except BadgerLogbookError as e:
logger.warning(e)
except ImportError:
logger.warning("Cannot save Screenshot. PIL package missing")


def screenshot(widget, filename):
Expand Down

0 comments on commit c774668

Please sign in to comment.