gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] Update on Python Version Compatibility


From: Fred Wright
Subject: Re: [gpsd-dev] Update on Python Version Compatibility
Date: Sun, 3 Apr 2016 15:12:04 -0700 (PDT)

On Sun, 3 Apr 2016, Eric S. Raymond wrote:
> Fred Wright <address@hidden>:
> > It looks like I missed the "wrapper" stuff when I was doing it the first
> > time, but it's probably just as well, since using the preexisting binary
> > stdout seems cleaner than the wrapper approach, anyway.
>
> Peter Donis and I would be open to a re-implementation of make_std_wrapper
> in those terms, I think.

It depends on the use case.  Since the binary stdout *only* accepts binary
data, it's fine to use it if you only write binary data, but if you need
to sometimes write "text" and sometimes write "binary", then you need the
wrapper to handle it.  In the former case, you can simply do:

try:
    sys.stdout = sys.stdout.buffer
except AttributeError:
    pass

For some reason that isn't entirely clear, the text and binary stdouts
don't use a common buffer, so you can't intermix them directly.

Fred Wright



reply via email to

[Prev in Thread] Current Thread [Next in Thread]