From 014730192c6a7325901da560d0228dfee28d9c4f Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 2 Sep 2017 16:29:58 +0200 Subject: [PATCH] try: u = unicode https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection This approach will work with Python 4 ;-) --- pyre/zhelper.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pyre/zhelper.py b/pyre/zhelper.py index f167763..9da6264 100644 --- a/pyre/zhelper.py +++ b/pyre/zhelper.py @@ -1,16 +1,17 @@ -import random -import zmq -import threading + import binascii import os +import random import sys +import threading +import zmq from . import zsocket - -if sys.version.startswith('3'): - u = str -else: +try: u = unicode +except NameError: + u = str + # -------------------------------------------------------------------------- # Create a pipe, which consists of two PAIR sockets connected over inproc.