Changeset 88:6f7fe3f9ca24 in xplra
- Timestamp:
- 05/12/13 09:05:51 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
misc/autosavesit.py
r84 r88 24 24 xplane = XPlane() 25 25 26 while True: 27 print "Connecting to X-Plane..." 26 print "Connecting to X-Plane..." 28 27 29 while not xplane.isConnected: 28 while not xplane.isConnected: 29 try: 30 xplane.connect() 31 except: 32 print "Connection failed, sleeping..." 33 time.sleep(0.5) 34 35 print "Connected to X-Plane" 36 37 try: 38 while True: 30 39 try: 31 xplane.connect() 32 except: 33 print "Connection failed, sleeping..." 34 time.sleep(0.5) 40 xplane.saveSituation(savePath) 41 try: 42 if os.path.exists(path): 43 os.rename(path, oldPath) 44 os.rename(newPath, path) 35 45 36 print "Connected to X-Plane" 37 46 print "Situation saved at " + time.strftime("%H:%M:%S") 47 except OSError, e: 48 print "I/O error occured: " + str(e) 49 except ProtocolException, e: 50 print "Protocol error occured: " + str(e) 51 time.sleep(interval) 52 except Exception, e: 53 print "Connection failed: " + str(e) 38 54 try: 39 while True:40 try:41 xplane.saveSituation(savePath)42 try:43 if os.path.exists(path):44 os.rename(path, oldPath)45 os.rename(newPath, path)46 47 print "Situation saved at " + time.strftime("%H:%M:%S")48 except OSError, e:49 print "I/O error occured: " + str(e)50 except ProtocolException, e:51 print "Protocol error occured: " + str(e)52 time.sleep(interval)53 except Exception, e:54 print "Connection failed: " + str(e)55 55 xplane.disconnect() 56 except: 57 pass
Note:
See TracChangeset
for help on using the changeset viewer.