import socket
import sys
+import six
+from six.moves import range
+
import ovs.fatal_signal
import ovs.poller
import ovs.vlog
long_name = os.path.abspath(long_name)
long_dirname = os.path.dirname(long_name)
tmpdir = os.getenv('TMPDIR', '/tmp')
- for x in xrange(0, 1000):
+ for x in range(0, 1000):
link_name = \
'%s/ovs-un-py-%d-%d' % (tmpdir, random.randint(0, 10000), x)
try:
exception is documented as having two completely different forms of
arguments: either a string or a (errno, string) tuple. We only want the
errno."""
- if type(e.args) == tuple:
+ if isinstance(e.args, tuple):
return e.args[0]
else:
return errno.EPROTO
bytes_written = 0
if len(buf) == 0:
return 0, 0
+ if sys.version_info[0] >= 3 and not isinstance(buf, six.binary_type):
+ buf = six.binary_type(buf, 'utf-8')
while True:
try:
retval = os.write(fd, buf)