Python example fix

Had to unpack tuple for string.format
This commit is contained in:
Chris Teubert
2015-08-25 11:02:35 -07:00
parent 9187c82e56
commit 96a6d16365

View File

@@ -7,18 +7,18 @@ def record(path, interval = 0.1, duration = 60):
except: except:
print "Unable to open file." print "Unable to open file."
return return
count = int(duration / interval) count = int(duration / interval)
if count < 1: if count < 1:
print "duration is less than a single frame." print "duration is less than a single frame."
return return
with xpc.XPlaneConnect("localhost", 49009, 0, 1000) as client: with xpc.XPlaneConnect("localhost", 49009, 0, 1000) as client:
print "Recording..." print "Recording..."
for i in range(0, count): for i in range(0, count):
try: try:
posi = client.getPOSI() posi = client.getPOSI()
fd.write("{0}, {1}, {2}, {3}, {4}, {5}, {6}\n".format(posi)) fd.write("{0}, {1}, {2}, {3}, {4}, {5}, {6}\n".format(*posi))
except: except:
print "Error reading position" print "Error reading position"
continue continue