odp-util: Format and scan multiple MPLS labels.
[cascardo/ovs.git] / python / ovs / socket_util.py
index 22ac3f9..9f46a55 100644 (file)
@@ -19,6 +19,7 @@ import random
 import socket
 import sys
 
+import six
 from six.moves import range
 
 import ovs.fatal_signal
@@ -275,6 +276,8 @@ def write_fully(fd, buf):
     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)