From a4b4df8b125af7afd75c54cfd391c1a29275e412 Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Mon, 27 Mar 2023 19:28:09 -0400 Subject: [PATCH] More error handling --- beetsplug/embedart.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/beetsplug/embedart.py b/beetsplug/embedart.py index 5df9f2e5a..d623c9942 100644 --- a/beetsplug/embedart.py +++ b/beetsplug/embedart.py @@ -122,8 +122,12 @@ class EmbedCoverArtPlugin(BeetsPlugin): except OSError as e: self._log.error("Error: {}".format(e)) if img.format: - with open('temp.jpg', 'wb') as f: - f.write(response.content) + try: + with open('temp.jpg', 'wb') as f: + f.write(response.content) + except Exception as e: + self._log.error(f"Error writing file: {e}" + ) opts.file = 'temp.jpg' items = lib.items(decargs(args)) # Confirm with user.