diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-11-10 22:45:10 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-11-10 22:45:10 +0100 |
commit | 097e5d00514ee6e8137f44a44a98d6795a712ba1 (patch) | |
tree | 7ebf8318dd00d0d8c464e1459a1662438cfc4a67 | |
parent | 330104f2a8ad071a79a73320f9cdc3d457cdbaa8 (diff) | |
download | ttystatus-097e5d00514ee6e8137f44a44a98d6795a712ba1.tar.gz |
Fix: another Py3 port buglet
-rw-r--r-- | ttystatus/area.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ttystatus/area.py b/ttystatus/area.py index 2bea1c6..9a78661 100644 --- a/ttystatus/area.py +++ b/ttystatus/area.py @@ -14,6 +14,17 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. +import sys + + +if sys.version_info >= (3,): + def xfrm(s): + return s.encode() +else: + def xfrm(s): + return s + + class AreaManager(object): '''Manage the area on the terminal for displaying messages.''' @@ -77,7 +88,7 @@ class AreaManager(object): if i > 0: parts.append(down) parts.append(cr) - parts.append(line[:max_chars].encode()) + parts.append(xfrm(line[:max_chars])) parts.append(erase) output = b''.join(parts) |