On Friday, February 2, 2018 at 7:03:53 AM UTC-6, lewis wrote:
 

>   File 
> "C:\Users\lewis\AppData\Local\Programs\Python\Python36\lib\socketserver.py", 
> line 775, in write
>     self._sock.sendall(b)
> TypeError: a bytes-like object is required, not 'str'
>
> Can you explain how to identify the str structure so I can apply the 
> change? 
>

The culprit appears to be that b is a str, not a bytes. 

The great thing about Python is that you have full access to most of the 
Python libs. Open socketserver.py in your favorite text editor, and look at 
the context of the error.  That may be enough.

Otherwise, you can add debugging code to socketserver.py as follows:

1. Before changing anything, init a git repo for the folder containing 
socketserver.py.  Git will give you diffs, and you can revert your changes 
later with git checkout socketserver.py.  This is important protection for 
your system.

2. In socketserver.py, replace:

    self._sock.sendall(b)

with:

    try:
       self._sock.sendall(b)
    except Exception:
        import leo.core.leoGlobals g # make *sure *g does not occur in the 
file!!
        g.trace(repr(b), g.callers())
        g.pdb()

HTH.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to