For my own learning I have used an example to show that I can change a str 
type to bytes with
b = g.toEncodedString(my_string)
and confirmed the change with the type() function. 

But from the log I can't recognise what the str is that needs changing in 
line 184:
  File "N:\git\leo-editor\leo\plugins\pygeotag\", line 184, in 
line 775, in write
TypeError: a bytes-like object is required, not 'str'

Can you explain how to identify the str structure so I can apply the 


On Saturday, January 27, 2018 at 12:25:41 AM UTC+11, Edward K. Ream wrote:
> In Leo, the best way (usually) to convert from a string to bytes type is 
> with:
>   b = g.toEncodedString(aString)
> This handles differences between python 2 and 3, and handles error 
> checking when aString.encode throws an exception. It also works when 
> aString is already a bytes object.
> Similarly, g.toUnicode(obj) is the best way to convert from bytes to 
> unicode.

You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to