Hello everyone I'm new to TypeSense I have a Pytho...
# community-help
m
Hello everyone I'm new to TypeSense I have a Python client and I'm trying to import data to it using this code:
Copy code
with open(jsonl_path, encoding='utf-8') as jsonl_file:
    client.collections[name].documents.import_(jsonl_file.read(), {'action': 'create'})
It's returning:
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 3340888-3340891: Body ('تونس') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
When I do
jsonl_file.read().encode('utf-8')
it returns
TypeError: Object of type bytes is not JSON serializable
How can I solve this?
k
You are using Python 3, right? Can you post a short github gist containing a sample file and the corresponding python code snippet using the import? That way I can reproduce and suggest.
k
Thanks, taking a look
@Mehdi Khlifi This requires an update to the Python client. I will publish it shortly so that you can test
@Mehdi Khlifi I just published 0.12.0 version of the Python client: can you please try using that? You still have to do
.encode('utf-8')
but it will work now.
m
Yes thank you ! 💯
k
👍