✘ 'AnsiTerm' object has no attribute 'buffer'

Gary E. Miller gem at rellim.com
Wed Jan 30 00:00:20 UTC 2019


Yo Gary!

On Tue, 29 Jan 2019 15:44:15 -0800
"Gary E. Miller via devel" <devel at ntpsec.org> wrote:

> Yo All!
> 
> > I figured out why some hosts have the below error, but not others.
> > 
> > If Python 2.7 is the system Python, it works.  If Python 3.5 or 3.6
> > is the system Python I get the below failure.  
> 
> Update:
> 
> Works: 2.7, 3.7
> Fails: 3.5, 3.6

From the python doc: https://docs.python.org/3/library/sys.html#sys.stdout


    Note

    To write or read binary data from/to the standard streams, use the
    underlying binary buffer object. For example, to write bytes to
    stdout, use sys.stdout.buffer.write(b'abc').

    However, if you are writing a library (and do not control in which
    context its code will be executed), be aware that the standard
    streams may be replaced with file-like objects like io.StringIO
    which do not support the buffer attribute.

So make_std_wrapper() is making a bad assumption that stream.buffer always
exists.

So the error exists in the upstream code that NTPsec grabbed from:

https://gitlab.com/esr/practical-python-porting/blob/master/polystr-inclusion.py

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 851 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20190129/cc032f4a/attachment.bin>


More information about the devel mailing list