Skip to content

Unicode error #5

@pimpalaputty

Description

@pimpalaputty

Hi,

I'm having trouble to make this code work:

client = Algorithmia.client(ALGO_TOKEN)

algo_text = client.algo('util/Html2Text/0.1.4')
algo_summary = client.algo('nlp/Summarizer/0.1.3')

link_text = algo_text.pipe(title).result
summary = algo_summary.pipe(link_text).result

The first result come back without problem, but I cannot give it as an input to the next API. What am I doing wrong? I tried to encode/decode to/from unicode. I couldn't figure it out.

Log:

2016-10-21 11:14:58,167 - ERROR: Unexpected error: Traceback (most recent call last):
File "/Users/iseckert/DevProjects/bot/linkcrawler-python-bot/bot/slack_bot.py", line 53, in start
event_handler.handle(event)
File "/Users/iseckert/DevProjects/bot/linkcrawler-python-bot/bot/event_handler.py", line 18, in handle
self._handle_by_type(event['type'], event)
File "/Users/iseckert/DevProjects/bot/linkcrawler-python-bot/bot/event_handler.py", line 27, in _handle_by_type
self._handle_message(event)
File "/Users/iseckert/DevProjects/bot/linkcrawler-python-bot/bot/event_handler.py", line 85, in _handle_message
summary = algo_summary.pipe(link_text).result
File "/usr/local/lib/python2.7/site-packages/Algorithmia/algorithm.py", line 39, in pipe
return AlgoResponse.create_algo_response(self.client.postJsonHelper(self.url, input1, *_self.query_parameters))
File "/usr/local/lib/python2.7/site-packages/Algorithmia/client.py", line 53, in postJsonHelper
response = requests.post(self.apiAddress + url, data=input_json, headers=headers, params=query_parameters)
File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 107, in post
return request('post', url, data=data, json=json, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 53, in request
return session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 353, in _make_request
conn.request(method, url, *_httplib_request_kw)
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1057, in request
self._send_request(method, url, body, headers)
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1097, in _send_request
self.endheaders(body)
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in endheaders
self._send_output(message_body)
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 901, in _send_output
self.send(message_body)
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 873, in send
self.sock.sendall(data)
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 743, in sendall
v = self.send(data[count:])
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 709, in send
v = self._sslobj.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 14: ordinal not in range(128)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions