Changeset 96:eef8ca34bc9e in xplra for src/client/python
- Timestamp:
- 05/19/19 11:18:03 (5 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/client/python/xplra.py
r95 r96 5 5 import struct 6 6 import array 7 import sys 8 9 isPy3 = sys.version_info[0] >= 3 7 10 8 11 #------------------------------------------------------------------------------- … … 274 277 def _packLength(x): 275 278 """Pack the given integer as a variable-length value.""" 276 s = ""279 s = bytes() if isPy3 else "" 277 280 while True: 278 281 y = x&0x7f … … 286 289 def _packString(s): 287 290 """Pack the given string.""" 288 return XPlane._packLength(len(s)) + s291 return XPlane._packLength(len(s)) + (bytes(s, "utf-8") if isPy3 else s) 289 292 290 293 def __init__(self): … … 305 308 s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) 306 309 s.connect("/tmp/xplra-" + os.environ["LOGNAME"]) 307 self._stream = s.makefile( )310 self._stream = s.makefile("rwb") 308 311 309 312 for multiBuffer in self._multiBuffers:
Note:
See TracChangeset
for help on using the changeset viewer.