We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Growl not registering
2018-11-10 08:21:42 INFO     CHECKVERSION :: [0c0a735] Checking for updates using GIT

**What you did: Input ip:port to register gowl
**What happened: Nothing!
**What you expected: Successful registration.

**Logs:**
2018-11-10 08:22:04 WARNING Thread_1 :: [0c0a735] GROWL: Unable to send growl to 192.168.1.4:23053 - u"error b'encode() takes exactly 1 argument (2 given)'"
2018-11-10 08:22:04 WARNING Thread_1 :: [0c0a735] GROWL: Unable to send growl to 192.168.1.4:23053 - u"error b'encode() takes exactly 1 argument (2 given)'"

Same IP:port work perfectly in rage/chill.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `medusa/notifiers/growl.py`
Content:
```
1 # coding=utf-8
2 
3 from __future__ import print_function
4 from __future__ import unicode_literals
5 
6 import logging
7 import socket
8 from builtins import object
9 
10 import gntp.core
11 
12 from medusa import app, common
13 from medusa.helper.exceptions import ex
14 from medusa.logger.adapters.style import BraceAdapter
15 
16 log = BraceAdapter(logging.getLogger(__name__))
17 log.logger.addHandler(logging.NullHandler())
18 
19 
20 class Notifier(object):
21     def test_notify(self, host, password):
22         self._sendRegistration(host, password)
23         return self._sendGrowl('Test Growl', 'Testing Growl settings from Medusa', 'Test', host, password,
24                                force=True)
25 
26     def notify_snatch(self, title, message):
27         if app.GROWL_NOTIFY_ONSNATCH:
28             self._sendGrowl(title, message)
29 
30     def notify_download(self, ep_obj):
31         if app.GROWL_NOTIFY_ONDOWNLOAD:
32             self._sendGrowl(common.notifyStrings[common.NOTIFY_DOWNLOAD], ep_obj.pretty_name_with_quality())
33 
34     def notify_subtitle_download(self, ep_obj, lang):
35         if app.GROWL_NOTIFY_ONSUBTITLEDOWNLOAD:
36             self._sendGrowl(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD], ep_obj.pretty_name() + ': ' + lang)
37 
38     def notify_git_update(self, new_version='??'):
39         update_text = common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
40         title = common.notifyStrings[common.NOTIFY_GIT_UPDATE]
41         self._sendGrowl(title, update_text + new_version)
42 
43     def notify_login(self, ipaddress=''):
44         update_text = common.notifyStrings[common.NOTIFY_LOGIN_TEXT]
45         title = common.notifyStrings[common.NOTIFY_LOGIN]
46         self._sendGrowl(title, update_text.format(ipaddress))
47 
48     def _send_growl(self, options, message=None):
49 
50         # Initialize Notification
51         notice = gntp.core.GNTPNotice(
52             app=options['app'],
53             name=options['name'],
54             title=options['title'],
55             password=options['password'],
56         )
57 
58         # Optional
59         if options['sticky']:
60             notice.add_header('Notification-Sticky', options['sticky'])
61         if options['priority']:
62             notice.add_header('Notification-Priority', options['priority'])
63         if options['icon']:
64             notice.add_header('Notification-Icon', app.LOGO_URL)
65 
66         if message:
67             notice.add_header('Notification-Text', message)
68 
69         response = self._send(options['host'], options['port'], notice.encode('utf-8'), options['debug'])
70         return True if isinstance(response, gntp.core.GNTPOK) else False
71 
72     @staticmethod
73     def _send(host, port, data, debug=False):
74         if debug:
75             print('<Sending>\n', data, '\n</Sending>')
76 
77         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
78         s.connect((host, port))
79         s.send(data)
80         response = gntp.core.parse_gntp(s.recv(1024))
81         s.close()
82 
83         if debug:
84             print('<Received>\n', response, '\n</Received>')
85 
86         return response
87 
88     def _sendGrowl(self, title='Medusa Notification', message=None, name=None, host=None, password=None,
89                    force=False):
90         if not app.USE_GROWL and not force:
91             return False
92 
93         if name is None:
94             name = title
95 
96         if host is None:
97             hostParts = app.GROWL_HOST.split(':')
98         else:
99             hostParts = host.split(':')
100 
101         if len(hostParts) != 2 or hostParts[1] == '':
102             port = 23053
103         else:
104             port = int(hostParts[1])
105 
106         growlHosts = [(hostParts[0], port)]
107 
108         opts = {
109             'name': name,
110             'title': title,
111             'app': 'Medusa',
112             'sticky': None,
113             'priority': None,
114             'debug': False
115         }
116 
117         if password is None:
118             opts['password'] = app.GROWL_PASSWORD
119         else:
120             opts['password'] = password
121 
122         opts['icon'] = True
123 
124         for pc in growlHosts:
125             opts['host'] = pc[0]
126             opts['port'] = pc[1]
127             log.debug(
128                 u'GROWL: Sending growl to {host}:{port} - {msg!r}',
129                 {'msg': message, 'host': opts['host'], 'port': opts['port']}
130             )
131             try:
132                 if self._send_growl(opts, message):
133                     return True
134                 else:
135                     if self._sendRegistration(host, password):
136                         return self._send_growl(opts, message)
137                     else:
138                         return False
139             except Exception as error:
140                 log.warning(
141                     u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',
142                     {'msg': ex(error), 'host': opts['host'], 'port': opts['port']}
143                 )
144                 return False
145 
146     def _sendRegistration(self, host=None, password=None):
147         opts = {}
148 
149         if host is None:
150             hostParts = app.GROWL_HOST.split(':')
151         else:
152             hostParts = host.split(':')
153 
154         if len(hostParts) != 2 or hostParts[1] == '':
155             port = 23053
156         else:
157             port = int(hostParts[1])
158 
159         opts['host'] = hostParts[0]
160         opts['port'] = port
161 
162         if password is None:
163             opts['password'] = app.GROWL_PASSWORD
164         else:
165             opts['password'] = password
166 
167         opts['app'] = 'Medusa'
168         opts['debug'] = False
169 
170         # Send Registration
171         register = gntp.core.GNTPRegister()
172         register.add_header('Application-Name', opts['app'])
173         register.add_header('Application-Icon', app.LOGO_URL)
174 
175         register.add_notification('Test', True)
176         register.add_notification(common.notifyStrings[common.NOTIFY_SNATCH], True)
177         register.add_notification(common.notifyStrings[common.NOTIFY_DOWNLOAD], True)
178         register.add_notification(common.notifyStrings[common.NOTIFY_GIT_UPDATE], True)
179 
180         if opts['password']:
181             register.set_password(opts['password'])
182 
183         try:
184             return self._send(opts['host'], opts['port'], register.encode('utf-8'), opts['debug'])
185         except Exception as error:
186             log.warning(
187                 u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',
188                 {'msg': ex(error), 'host': opts['host'], 'port': opts['port']}
189             )
190             return False
191
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/medusa/notifiers/growl.py b/medusa/notifiers/growl.py
--- a/medusa/notifiers/growl.py
+++ b/medusa/notifiers/growl.py
@@ -66,7 +66,7 @@
         if message:
             notice.add_header('Notification-Text', message)
 
-        response = self._send(options['host'], options['port'], notice.encode('utf-8'), options['debug'])
+        response = self._send(options['host'], options['port'], notice.encode(), options['debug'])
         return True if isinstance(response, gntp.core.GNTPOK) else False
 
     @staticmethod
@@ -181,7 +181,7 @@
             register.set_password(opts['password'])
 
         try:
-            return self._send(opts['host'], opts['port'], register.encode('utf-8'), opts['debug'])
+            return self._send(opts['host'], opts['port'], register.encode(), opts['debug'])
         except Exception as error:
             log.warning(
                 u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',

{"golden_diff": "diff --git a/medusa/notifiers/growl.py b/medusa/notifiers/growl.py\n--- a/medusa/notifiers/growl.py\n+++ b/medusa/notifiers/growl.py\n@@ -66,7 +66,7 @@\n         if message:\n             notice.add_header('Notification-Text', message)\n \n-        response = self._send(options['host'], options['port'], notice.encode('utf-8'), options['debug'])\n+        response = self._send(options['host'], options['port'], notice.encode(), options['debug'])\n         return True if isinstance(response, gntp.core.GNTPOK) else False\n \n     @staticmethod\n@@ -181,7 +181,7 @@\n             register.set_password(opts['password'])\n \n         try:\n-            return self._send(opts['host'], opts['port'], register.encode('utf-8'), opts['debug'])\n+            return self._send(opts['host'], opts['port'], register.encode(), opts['debug'])\n         except Exception as error:\n             log.warning(\n                 u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',\n", "issue": "Growl not registering\n2018-11-10 08:21:42 INFO     CHECKVERSION :: [0c0a735] Checking for updates using GIT\r\n\r\n**What you did: Input ip:port to register gowl\r\n**What happened: Nothing!\r\n**What you expected: Successful registration.\r\n\r\n**Logs:**\r\n2018-11-10 08:22:04 WARNING Thread_1 :: [0c0a735] GROWL: Unable to send growl to 192.168.1.4:23053 - u\"error b'encode() takes exactly 1 argument (2 given)'\"\r\n2018-11-10 08:22:04 WARNING Thread_1 :: [0c0a735] GROWL: Unable to send growl to 192.168.1.4:23053 - u\"error b'encode() takes exactly 1 argument (2 given)'\"\r\n\r\nSame IP:port work perfectly in rage/chill.\r\n\n", "before_files": [{"content": "# coding=utf-8\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport logging\nimport socket\nfrom builtins import object\n\nimport gntp.core\n\nfrom medusa import app, common\nfrom medusa.helper.exceptions import ex\nfrom medusa.logger.adapters.style import BraceAdapter\n\nlog = BraceAdapter(logging.getLogger(__name__))\nlog.logger.addHandler(logging.NullHandler())\n\n\nclass Notifier(object):\n    def test_notify(self, host, password):\n        self._sendRegistration(host, password)\n        return self._sendGrowl('Test Growl', 'Testing Growl settings from Medusa', 'Test', host, password,\n                               force=True)\n\n    def notify_snatch(self, title, message):\n        if app.GROWL_NOTIFY_ONSNATCH:\n            self._sendGrowl(title, message)\n\n    def notify_download(self, ep_obj):\n        if app.GROWL_NOTIFY_ONDOWNLOAD:\n            self._sendGrowl(common.notifyStrings[common.NOTIFY_DOWNLOAD], ep_obj.pretty_name_with_quality())\n\n    def notify_subtitle_download(self, ep_obj, lang):\n        if app.GROWL_NOTIFY_ONSUBTITLEDOWNLOAD:\n            self._sendGrowl(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD], ep_obj.pretty_name() + ': ' + lang)\n\n    def notify_git_update(self, new_version='??'):\n        update_text = common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]\n        title = common.notifyStrings[common.NOTIFY_GIT_UPDATE]\n        self._sendGrowl(title, update_text + new_version)\n\n    def notify_login(self, ipaddress=''):\n        update_text = common.notifyStrings[common.NOTIFY_LOGIN_TEXT]\n        title = common.notifyStrings[common.NOTIFY_LOGIN]\n        self._sendGrowl(title, update_text.format(ipaddress))\n\n    def _send_growl(self, options, message=None):\n\n        # Initialize Notification\n        notice = gntp.core.GNTPNotice(\n            app=options['app'],\n            name=options['name'],\n            title=options['title'],\n            password=options['password'],\n        )\n\n        # Optional\n        if options['sticky']:\n            notice.add_header('Notification-Sticky', options['sticky'])\n        if options['priority']:\n            notice.add_header('Notification-Priority', options['priority'])\n        if options['icon']:\n            notice.add_header('Notification-Icon', app.LOGO_URL)\n\n        if message:\n            notice.add_header('Notification-Text', message)\n\n        response = self._send(options['host'], options['port'], notice.encode('utf-8'), options['debug'])\n        return True if isinstance(response, gntp.core.GNTPOK) else False\n\n    @staticmethod\n    def _send(host, port, data, debug=False):\n        if debug:\n            print('<Sending>\\n', data, '\\n</Sending>')\n\n        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        s.connect((host, port))\n        s.send(data)\n        response = gntp.core.parse_gntp(s.recv(1024))\n        s.close()\n\n        if debug:\n            print('<Received>\\n', response, '\\n</Received>')\n\n        return response\n\n    def _sendGrowl(self, title='Medusa Notification', message=None, name=None, host=None, password=None,\n                   force=False):\n        if not app.USE_GROWL and not force:\n            return False\n\n        if name is None:\n            name = title\n\n        if host is None:\n            hostParts = app.GROWL_HOST.split(':')\n        else:\n            hostParts = host.split(':')\n\n        if len(hostParts) != 2 or hostParts[1] == '':\n            port = 23053\n        else:\n            port = int(hostParts[1])\n\n        growlHosts = [(hostParts[0], port)]\n\n        opts = {\n            'name': name,\n            'title': title,\n            'app': 'Medusa',\n            'sticky': None,\n            'priority': None,\n            'debug': False\n        }\n\n        if password is None:\n            opts['password'] = app.GROWL_PASSWORD\n        else:\n            opts['password'] = password\n\n        opts['icon'] = True\n\n        for pc in growlHosts:\n            opts['host'] = pc[0]\n            opts['port'] = pc[1]\n            log.debug(\n                u'GROWL: Sending growl to {host}:{port} - {msg!r}',\n                {'msg': message, 'host': opts['host'], 'port': opts['port']}\n            )\n            try:\n                if self._send_growl(opts, message):\n                    return True\n                else:\n                    if self._sendRegistration(host, password):\n                        return self._send_growl(opts, message)\n                    else:\n                        return False\n            except Exception as error:\n                log.warning(\n                    u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',\n                    {'msg': ex(error), 'host': opts['host'], 'port': opts['port']}\n                )\n                return False\n\n    def _sendRegistration(self, host=None, password=None):\n        opts = {}\n\n        if host is None:\n            hostParts = app.GROWL_HOST.split(':')\n        else:\n            hostParts = host.split(':')\n\n        if len(hostParts) != 2 or hostParts[1] == '':\n            port = 23053\n        else:\n            port = int(hostParts[1])\n\n        opts['host'] = hostParts[0]\n        opts['port'] = port\n\n        if password is None:\n            opts['password'] = app.GROWL_PASSWORD\n        else:\n            opts['password'] = password\n\n        opts['app'] = 'Medusa'\n        opts['debug'] = False\n\n        # Send Registration\n        register = gntp.core.GNTPRegister()\n        register.add_header('Application-Name', opts['app'])\n        register.add_header('Application-Icon', app.LOGO_URL)\n\n        register.add_notification('Test', True)\n        register.add_notification(common.notifyStrings[common.NOTIFY_SNATCH], True)\n        register.add_notification(common.notifyStrings[common.NOTIFY_DOWNLOAD], True)\n        register.add_notification(common.notifyStrings[common.NOTIFY_GIT_UPDATE], True)\n\n        if opts['password']:\n            register.set_password(opts['password'])\n\n        try:\n            return self._send(opts['host'], opts['port'], register.encode('utf-8'), opts['debug'])\n        except Exception as error:\n            log.warning(\n                u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',\n                {'msg': ex(error), 'host': opts['host'], 'port': opts['port']}\n            )\n            return False\n", "path": "medusa/notifiers/growl.py"}], "after_files": [{"content": "# coding=utf-8\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport logging\nimport socket\nfrom builtins import object\n\nimport gntp.core\n\nfrom medusa import app, common\nfrom medusa.helper.exceptions import ex\nfrom medusa.logger.adapters.style import BraceAdapter\n\nlog = BraceAdapter(logging.getLogger(__name__))\nlog.logger.addHandler(logging.NullHandler())\n\n\nclass Notifier(object):\n    def test_notify(self, host, password):\n        self._sendRegistration(host, password)\n        return self._sendGrowl('Test Growl', 'Testing Growl settings from Medusa', 'Test', host, password,\n                               force=True)\n\n    def notify_snatch(self, title, message):\n        if app.GROWL_NOTIFY_ONSNATCH:\n            self._sendGrowl(title, message)\n\n    def notify_download(self, ep_obj):\n        if app.GROWL_NOTIFY_ONDOWNLOAD:\n            self._sendGrowl(common.notifyStrings[common.NOTIFY_DOWNLOAD], ep_obj.pretty_name_with_quality())\n\n    def notify_subtitle_download(self, ep_obj, lang):\n        if app.GROWL_NOTIFY_ONSUBTITLEDOWNLOAD:\n            self._sendGrowl(common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD], ep_obj.pretty_name() + ': ' + lang)\n\n    def notify_git_update(self, new_version='??'):\n        update_text = common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]\n        title = common.notifyStrings[common.NOTIFY_GIT_UPDATE]\n        self._sendGrowl(title, update_text + new_version)\n\n    def notify_login(self, ipaddress=''):\n        update_text = common.notifyStrings[common.NOTIFY_LOGIN_TEXT]\n        title = common.notifyStrings[common.NOTIFY_LOGIN]\n        self._sendGrowl(title, update_text.format(ipaddress))\n\n    def _send_growl(self, options, message=None):\n\n        # Initialize Notification\n        notice = gntp.core.GNTPNotice(\n            app=options['app'],\n            name=options['name'],\n            title=options['title'],\n            password=options['password'],\n        )\n\n        # Optional\n        if options['sticky']:\n            notice.add_header('Notification-Sticky', options['sticky'])\n        if options['priority']:\n            notice.add_header('Notification-Priority', options['priority'])\n        if options['icon']:\n            notice.add_header('Notification-Icon', app.LOGO_URL)\n\n        if message:\n            notice.add_header('Notification-Text', message)\n\n        response = self._send(options['host'], options['port'], notice.encode(), options['debug'])\n        return True if isinstance(response, gntp.core.GNTPOK) else False\n\n    @staticmethod\n    def _send(host, port, data, debug=False):\n        if debug:\n            print('<Sending>\\n', data, '\\n</Sending>')\n\n        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        s.connect((host, port))\n        s.send(data)\n        response = gntp.core.parse_gntp(s.recv(1024))\n        s.close()\n\n        if debug:\n            print('<Received>\\n', response, '\\n</Received>')\n\n        return response\n\n    def _sendGrowl(self, title='Medusa Notification', message=None, name=None, host=None, password=None,\n                   force=False):\n        if not app.USE_GROWL and not force:\n            return False\n\n        if name is None:\n            name = title\n\n        if host is None:\n            hostParts = app.GROWL_HOST.split(':')\n        else:\n            hostParts = host.split(':')\n\n        if len(hostParts) != 2 or hostParts[1] == '':\n            port = 23053\n        else:\n            port = int(hostParts[1])\n\n        growlHosts = [(hostParts[0], port)]\n\n        opts = {\n            'name': name,\n            'title': title,\n            'app': 'Medusa',\n            'sticky': None,\n            'priority': None,\n            'debug': False\n        }\n\n        if password is None:\n            opts['password'] = app.GROWL_PASSWORD\n        else:\n            opts['password'] = password\n\n        opts['icon'] = True\n\n        for pc in growlHosts:\n            opts['host'] = pc[0]\n            opts['port'] = pc[1]\n            log.debug(\n                u'GROWL: Sending growl to {host}:{port} - {msg!r}',\n                {'msg': message, 'host': opts['host'], 'port': opts['port']}\n            )\n            try:\n                if self._send_growl(opts, message):\n                    return True\n                else:\n                    if self._sendRegistration(host, password):\n                        return self._send_growl(opts, message)\n                    else:\n                        return False\n            except Exception as error:\n                log.warning(\n                    u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',\n                    {'msg': ex(error), 'host': opts['host'], 'port': opts['port']}\n                )\n                return False\n\n    def _sendRegistration(self, host=None, password=None):\n        opts = {}\n\n        if host is None:\n            hostParts = app.GROWL_HOST.split(':')\n        else:\n            hostParts = host.split(':')\n\n        if len(hostParts) != 2 or hostParts[1] == '':\n            port = 23053\n        else:\n            port = int(hostParts[1])\n\n        opts['host'] = hostParts[0]\n        opts['port'] = port\n\n        if password is None:\n            opts['password'] = app.GROWL_PASSWORD\n        else:\n            opts['password'] = password\n\n        opts['app'] = 'Medusa'\n        opts['debug'] = False\n\n        # Send Registration\n        register = gntp.core.GNTPRegister()\n        register.add_header('Application-Name', opts['app'])\n        register.add_header('Application-Icon', app.LOGO_URL)\n\n        register.add_notification('Test', True)\n        register.add_notification(common.notifyStrings[common.NOTIFY_SNATCH], True)\n        register.add_notification(common.notifyStrings[common.NOTIFY_DOWNLOAD], True)\n        register.add_notification(common.notifyStrings[common.NOTIFY_GIT_UPDATE], True)\n\n        if opts['password']:\n            register.set_password(opts['password'])\n\n        try:\n            return self._send(opts['host'], opts['port'], register.encode(), opts['debug'])\n        except Exception as error:\n            log.warning(\n                u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',\n                {'msg': ex(error), 'host': opts['host'], 'port': opts['port']}\n            )\n            return False\n", "path": "medusa/notifiers/growl.py"}]}