Skip to content

add encoding feature for py3 tarantool.connect #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 1, 2015

Conversation

shveenkov
Copy link
Contributor

if you want to insert binary data in tarantool, msgpack.unpack raise Exception in python3

>>> import tarantool
>>> import msgpack
>>> tnt=tarantool.connect("127.0.0.1", 3301)
>>> tnt.insert("tester", (1, msgpack.packb([1,2,3,"foo"])))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/shveenkov/env_34/lib/python3.4/site-packages/tarantool/connection.py", line 389, in insert
    return self._send_request(request)
  File "/home/shveenkov/env_34/lib/python3.4/site-packages/tarantool/connection.py", line 275, in _send_request
    request)
  File "/home/shveenkov/env_34/lib/python3.4/site-packages/tarantool/connection.py", line 199, in _send_request_wo_reconnect
    response = Response(self, self._read_response())
  File "/home/shveenkov/env_34/lib/python3.4/site-packages/tarantool/response.py", line 57, in __init__
    self._body = unpacker.unpack()
  File "msgpack/_unpacker.pyx", line 427, in msgpack._unpacker.Unpacker.unpack (msgpack/_unpacker.cpp:427)
  File "msgpack/_unpacker.pyx", line 390, in msgpack._unpacker.Unpacker._unpack (msgpack/_unpacker.cpp:390)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x94 in position 0: invalid start byte
>>> 
>>> 
>>> tnt=tarantool.connect("127.0.0.1", 3301, encoding=None)
>>> tnt.insert("tester", (1, msgpack.packb([1,2,3,"foo"])))

@shveenkov shveenkov changed the title add encoding feature for tarantool.connect for py3 add encoding feature for py3 tarantool.connect Sep 23, 2015
bigbes added a commit that referenced this pull request Oct 1, 2015
add encoding feature for py3 tarantool.connect
@bigbes bigbes merged commit 9160c58 into tarantool:master Oct 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants