Skip to content

Commit

Permalink
Handle if uploading throws an error
Browse files Browse the repository at this point in the history
  • Loading branch information
ow committed Apr 24, 2023
1 parent fa0a0b9 commit 8f0d359
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions art.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@
if remote_filename is None:
logging.info('Uploading new image: ' + str(file))

if file.endswith('.jpg'):
remote_filename = tv.art().upload(data, file_type='JPEG', matte="none")
elif file.endswith('.png'):
remote_filename = tv.art().upload(data, file_type='PNG', matte="none")

try:
if file.endswith('.jpg'):
remote_filename = tv.art().upload(data, file_type='JPEG', matte="none")
elif file.endswith('.png'):
remote_filename = tv.art().upload(data, file_type='PNG', matte="none")
except Exception as e:
logging.error('There was an error: ' + str(e))
sys.exit()

# Add the filename to the list of uploaded filenames
uploaded_files.append({'file': file, 'remote_filename': remote_filename})

Expand Down

0 comments on commit 8f0d359

Please sign in to comment.