Changeset 97:28052c8e62c9 in xplra for misc/autosavesit.py


Ignore:
Timestamp:
06/10/19 08:37:18 (5 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 3 'hg:/home/ivaradi/xplane/hg/xplra' '/'>, 'public')
Message:

Some helper scripts are ported to Python 3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • misc/autosavesit.py

    r88 r97  
    1 #!/usr/bin/env python
     1#!/usr/bin/env python3
    22#
    33# Program to automatically save the situation at certain intervals
     
    2424    xplane = XPlane()
    2525
    26     print "Connecting to X-Plane..."
     26    print("Connecting to X-Plane...")
    2727
    2828    while not xplane.isConnected:
     
    3030            xplane.connect()
    3131        except:
    32             print "Connection failed, sleeping..."
     32            print("Connection failed, sleeping...")
    3333            time.sleep(0.5)
    3434
    35     print "Connected to X-Plane"
     35    print("Connected to X-Plane")
    3636
    3737    try:
     
    4444                    os.rename(newPath, path)
    4545
    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)
     46                    print("Situation saved at " + time.strftime("%H:%M:%S"))
     47                except OSError as e:
     48                    print("I/O error occured: " + str(e))
     49            except ProtocolException as e:
     50                print("Protocol error occured: " + str(e))
    5151            time.sleep(interval)
    52     except Exception, e:
    53         print "Connection failed: " + str(e)
     52    except Exception as e:
     53        print("Connection failed: " + str(e))
    5454        try:
    5555            xplane.disconnect()
Note: See TracChangeset for help on using the changeset viewer.