From 8c111a95f19f4216c300ef8e4d04146fa611efe1 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 15 Jan 2021 10:32:01 +0100 Subject: Convert to python3. --- nephilim/plugins/Lyrics.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nephilim/plugins/Lyrics.py') diff --git a/nephilim/plugins/Lyrics.py b/nephilim/plugins/Lyrics.py index b569094..a07916d 100644 --- a/nephilim/plugins/Lyrics.py +++ b/nephilim/plugins/Lyrics.py @@ -262,7 +262,7 @@ class Lyrics(Plugin): if lyrics: self.save_lyrics(lyrics) return self.o.set_lyrics(song, lyrics) - except IOError, e: + except IOError as e: self.logger.info('Error reading lyrics file: %s.'%e) for fetcher in self.__fetchers: @@ -286,7 +286,7 @@ class Lyrics(Plugin): try: os.remove(path) - except (IOError, OSError), e: + except (IOError, OSError) as e: self.logger.error('Error removing lyrics file %s: %s'%(path, e)) def get_settings_widget(self): @@ -385,8 +385,8 @@ class FetchAnimelyrics(metadata_fetcher.MetadataFetcher): def __handle_search_res(self): # TODO use Qt xml functions try: - tree = etree.HTML(unicode(self.rep.readAll(), encoding = 'utf-8', errors='ignore')) - except etree.XMLSyntaxError, e: + tree = etree.HTML(str(self.rep.readAll(), encoding = 'utf-8', errors='ignore')) + except etree.XMLSyntaxError as e: self.logger.error('Error parsing lyrics: %s' %e) return self.finish() @@ -407,8 +407,8 @@ class FetchAnimelyrics(metadata_fetcher.MetadataFetcher): def __handle_lyrics(self): lyrics = '' try: - tree = etree.HTML(unicode(self.rep.readAll(), encoding = 'utf-8')) - except etree.XMLSyntaxError, e: + tree = etree.HTML(str(self.rep.readAll(), encoding = 'utf-8')) + except etree.XMLSyntaxError as e: self.logger.error('Error parsing lyrics: %s' %e) return self.finish() for elem in tree.iterfind('.//pre'): -- cgit v1.2.3