Closed ei-grad closed 6 years ago
Python 3.6.3 (default, Oct 24 2017, 14:48:20) Type 'copyright', 'credits' or 'license' for more information IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: import telepyth In [2]: %telepyth "hello, world" Out[2]: 'hello, world' --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-2-f9dd9ac11554> in <module>() ----> 1 get_ipython().run_line_magic('telepyth', '"hello, world"') /usr/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth) 2093 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals 2094 with self.builtin_trap: -> 2095 result = fn(*args,**kwargs) 2096 return result 2097 <decorator-gen-116> in telepyth(self, line, cell) /usr/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k) 185 # but it's overkill for just that one bit of state. 186 def magic_deco(arg): --> 187 call = lambda f, *a, **k: f(*a, **k) 188 189 if callable(arg): ~/.local/lib/python3.6/site-packages/telepyth/magics.py in telepyth(self, line, cell) 113 stream.seek(0) 114 --> 115 self.send(stream, mode) 116 117 def send(self, payload, markdown=False): ~/.local/lib/python3.6/site-packages/telepyth/magics.py in send(self, payload, markdown) 119 if not self.client: 120 print('Nobody to notify: token is not set.', file=stderr) --> 121 elif self.client(payload, markdown) != 200: 122 print('Notification was failed.', file=stderr) 123 ~/.local/lib/python3.6/site-packages/telepyth/client.py in __call__(self, text, markdown) 48 49 def __call__(self, text, markdown=True): ---> 50 url = self.base_url + self.access_token 51 52 req = Request(url, method='POST') TypeError: must be str, not NoneType
It seems there is no good fix for this issue. In the upcomming commit TelePythClient just checks token and raise value exception but still it is not safe for user.
TelePythClient