diff mbox series

[22/24] pynfs: python3 support plan: fix ord() failure on python3

Message ID 20180724073342.5738-22-jiyin@redhat.com (mailing list archive)
State New, archived
Headers show
Series [01/24] pynfs: python3 support plan: print -> print() | expand

Commit Message

Jianhong Yin July 24, 2018, 7:33 a.m. UTC
From: "Jianhong.Yin" <yin-jianhong@163.com>

Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
 nfs4.0/nfs4lib.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
index 79e386e..82fa4d8 100644
--- a/nfs4.0/nfs4lib.py
+++ b/nfs4.0/nfs4lib.py
@@ -144,7 +144,10 @@  class CBServer(rpc.RPCServer):
         self.client = client
         rpc.RPCServer.__init__(self, prog=self.prog, vers=1, port=self.port)
         packed = struct.pack('>H', self.port)
-        self.dotport = '.%s.%s' % (ord(packed[0]), ord(packed[1]))
+        try:     #for python2
+            self.dotport = '.%s.%s' % (ord(packed[0]), ord(packed[1]))
+        except:  #for python3
+            self.dotport = '.%s.%s' % ((packed[0]), (packed[1]))
         self.nfs4packer = FancyNFS4Packer()
         self.nfs4unpacker = FancyNFS4Unpacker('')
         self.recall_lock = threading.Lock()