Python API: VPP-947 Empty chroot_prefix fails on encode()

Change-Id: Ide2cdc456f3ab3219930fb8e423b871810469cdc
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/src/vpp-api/python/vpp_papi.py b/src/vpp-api/python/vpp_papi.py
index c1fa9e8..489731a 100644
--- a/src/vpp-api/python/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi.py
@@ -449,8 +449,8 @@
 
     def connect_internal(self, name, msg_handler, chroot_prefix, rx_qlen,
                          async):
-        rv = vpp_api.vac_connect(name.encode(), chroot_prefix.encode(),
-                                 msg_handler, rx_qlen)
+        pfx = chroot_prefix.encode() if chroot_prefix else ffi.NULL
+        rv = vpp_api.vac_connect(name.encode(), pfx, msg_handler, rx_qlen)
         if rv != 0:
             raise IOError(2, 'Connect failed')
         self.connected = True
@@ -465,7 +465,7 @@
         self.control_ping_msgdef = self.messages['control_ping']
         return rv
 
-    def connect(self, name, chroot_prefix=ffi.NULL, async=False, rx_qlen=32):
+    def connect(self, name, chroot_prefix=None, async=False, rx_qlen=32):
         """Attach to VPP.
 
         name - the name of the client.
@@ -478,7 +478,7 @@
         return self.connect_internal(name, msg_handler, chroot_prefix, rx_qlen,
                                      async)
 
-    def connect_sync(self, name, chroot_prefix=ffi.NULL, rx_qlen=32):
+    def connect_sync(self, name, chroot_prefix=None, rx_qlen=32):
         """Attach to VPP in synchronous mode. Application must poll for events.
 
         name - the name of the client.