home · contact · privacy
Add idna Unicode decoding error handler to URL follower.
[plomlombot-irc.git] / plomlombot.py
index b95bb42499f2f99f3c701b869d4ac84670efcc8b..ed0279279076217fb192ce3f49a76c570d90c111 100755 (executable)
@@ -246,7 +246,7 @@ def handle_command(command, argument, notice, target, session):
     def twt():
         def try_open(mode):
             try:
-                twtfile = open(session.twtfile, "w")
+                twtfile = open(session.twtfile, mode)
             except (PermissionError, FileNotFoundError) as err:
                 notice("CAN'T ACCESS OR CREATE TWT FILE: " + str(err))
                 return None
@@ -293,6 +293,7 @@ def handle_url(url, notice, show_url=False):
     except (requests.exceptions.TooManyRedirects,
             requests.exceptions.ConnectionError,
             requests.exceptions.InvalidURL,
+            UnicodeError,
             requests.exceptions.InvalidSchema) as error:
         notice("TROUBLE FOLLOWING URL: " + str(error))
         return