mardi 5 janvier 2016

if loop repeating first if statement [duplicate]

I'm trying to create a continuous question loop to process all my calculations for my nmea sentences in my project. For some reason only the first if statement is executed. What am I doing wrong? I'm still fairly new to python

   if command_type == "$GPGGA" or "GPGGA" or "GGA":
        #define the classes
        gps = GPS()
        createworkbook = CreateWorkbook()
        convertfile = ConvertFile()
        print_gps = PrintGPS()
        #do the deeds
        createworkbook.openworkbook(data)
        print_gps.process_gpgga_data(data)
        createworkbook.closeworkbook_gpgga(data) 
        convertfile.convert2csv(data)
        convertfile.convert2kml(data)
    if command_type == "$GPRMC" or "GPRMC" or "RMC":
        #define the classes
        gps = GPS()
        createworkbook = CreateWorkbook()
        convertfile = ConvertFile()
        print_gps = PrintGPS()
        #do the deeds
        createworkbook.openworkbook(data)
        print_gps.process_gprmc_data(data)
        createworkbook.closeworkbook_gprmc(data) 
        convertfile.convert2csv(data)
        convertfile.convert2kml(data)
    if command_type == "$GPGLL" or "GPGLL" or "GLL":
        #define the classes
        gps = GPS()
        createworkbook = CreateWorkbook()
        convertfile = ConvertFile()
        print_gps = PrintGPS()
        #do the deeds
        createworkbook.openworkbook(data)
        print_gps.process_gpgll_data(data)
        createworkbook.closeworkbook_gpgll(data) 
        convertfile.convert2csv(data)
        convertfile.convert2kml(data)
    if command_type == "$GPGSA" or "GPGSA" or "GSA":
        #define the classes
        gps = GPS()
        createworkbook = CreateWorkbook()
        convertfile = ConvertFile()
        print_gps = PrintGPS()
        #do the deeds
        createworkbook.openworkbook(data)
        print_gps.process_gpgsa_data(data)
        createworkbook.closeworkbook_gpgsa(data) 
        convertfile.convert2csv(data)  
    if command_type == "$GPVTG" or "GPVTG" or "VTG":
        print('Better check $GPRMC')
    else:
        print("Invalid type:", command_type)

    list_gps_commands(data)     
    wannalook = input('Want to look at another message or no?')
    if not wannalook.startswith('y'):
        keep_asking = False
        print('********************')
        print('**mischief managed**')
        print('********************')

Aucun commentaire:

Enregistrer un commentaire