question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

line 219 in elasticsearch/client/__init__.py (bytes error)

See original GitHub issue

This line is

def _bulk_body(self, body):
        # if not passed in a string, serialize items and join by newline
        if not isinstance(body, string_types):
            body = '\n'.join(map(self.transport.serializer.dumps, body))

        # bulk body must end with a newline
        if not body.endswith('\n'):
            body += '\n'

        return body

In the section checking for the \n endswith only accepts bytes so this needs to be b’\n’.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
daniel-gallaghercommented, Mar 12, 2020

I think you may have wanted to tag @danielmitterdorfer?

0reactions
danielmitterdorfercommented, Mar 13, 2020

Thanks for the feedback. Unfortunately I am swamped with work at the moment so it might take a while until I get to it. I can keep an eye on the issue though and can look into submitting a PR when things get more quiet again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bytes message argument error - python - Stack Overflow
bytes () in Python 2.x is the same as str() and it accepts only one string argument. Use just message = "Message" and...
Read more >
What is bytes.decode() in Python? - Educative.io
Line 5: We call the decode() method with utf-8 encoding scheme and strict as error handler to transform from encoded values to a...
Read more >
struct — Interpret bytes as packed binary data — Python 3.11 ...
When packing a value x using one of the integer formats ( 'b' , 'B' , 'h' , 'H' , 'i' , 'I'...
Read more >
How to convert Python string to bytes? | Flexiple Tutorials
The bytes() method is an inbuilt function that can be used to convert objects to byte objects. Syntax of bytes(): bytes(str, enc, error)....
Read more >
Python bytes() method - GeeksforGeeks
enc : The encoding required in case object is a string; err : Way to handle error in case the string conversion fails....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found