Browse Source

use floor division

pull/1780/head
tim watts 9 years ago
parent
commit
eece2ae7a5
3 changed files with 3 additions and 5 deletions
  1. +1
    -1
      example/python3/app.py
  2. +1
    -3
      example/python3/tmsp/server.py
  3. +1
    -1
      example/python3/tmsp/wire.py

+ 1
- 1
example/python3/app.py View File

@ -56,7 +56,7 @@ class CounterAppContext():
return "", 0
h = encode_big_endian(self.txCount, 8)
h.reverse()
return str(h), 0
return h.decode(), 0
def commit(self):
self.commitCount += 1


+ 1
- 3
example/python3/tmsp/server.py View File

@ -165,9 +165,7 @@ class TMSPServer():
self.handle_conn_closed(r)
return
except Exception as e:
import sys
print(sys.exc_info()[0])
print("error reading from connection", str(e))
logger.exception("error reading from connection")
self.handle_conn_closed(r)
return


+ 1
- 1
example/python3/tmsp/wire.py View File

@ -29,7 +29,7 @@ def uvarint_size(i):
def encode_big_endian(i, size):
if size == 0:
return bytearray()
return encode_big_endian(i / 256, size - 1) + bytearray([i % 256])
return encode_big_endian(i // 256, size - 1) + bytearray([i % 256])
def decode_big_endian(reader, size):


Loading…
Cancel
Save