Python Forum
Help to understand my mistake
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help to understand my mistake
#5
(Jul-04-2019, 05:31 PM)noisefloor Wrote: Thus the request to show more code. Otherwise, nobody can help you.
He did post a link to all code on Github in his post.

@TeeMan the code has several errors and do not look good,SyntaxError is always simple errors.
Do not 1-space as indentation,in Python is always 4-space.
To clean most up,i can of course not run this code for testing.
def main():
    index = 0
    gpsp = GpsPoller() # create the thread
    try:
        gpsp.start() # start it up 
        while index == 1:
            lcd.lcd_clear()
            printMessage_1()
            time.sleep(2)   
            lcd.lcd_clear()
            printMessage_2()
            time.sleep(2)   
            lcd.lcd_clear()
            printMessage_3()
            time.sleep(7)   
            lcd.lcd_clear()
            printMessage_4()
            time.sleep(2)   
            lcd.lcd_clear()
            printMessage_5()
            time.sleep(3)   
            lcd.lcd_clear()
            printMessage_6()
            time.sleep(3)   
            lcd.lcd_clear()
            printMessage_7()
            time.sleep(3)   
            lcd.lcd_clear()
            printMessage_8()
            time.sleep(5)   
            lcd.lcd_clear()
            printMessage_9()
            time.sleep(3)   
            lcd.lcd_clear()
            printMessage_10()
            time.sleep(5)
            index += 1
        while True:
            lcd.lcd_clear()
            printMessageTime()
            time.sleep(7)
            lcd.lcd_clear()
            printMessageAltitude()
            time.sleep(7)
            lcd.lcd_clear()
            printMessageQTH()
            time.sleep(7)
    except Exception as error:
        print(error)         

if __name__ == '__main__':
    try:
        main()
    except (KeyboardInterrupt, SystemExit):
        gpsp.running = False
        gpsp.join()
You had a try without a except.
So added this to avoid SyntaxError.
except Exception as error:
    print(error)   
Reply


Messages In This Thread
Help to understand my mistake - by TeeMan - Jul-04-2019, 02:37 PM
RE: Help to understand my mistake - by Larz60+ - Jul-04-2019, 04:02 PM
RE: Help to understand my mistake - by TeeMan - Jul-04-2019, 04:09 PM
RE: Help to understand my mistake - by noisefloor - Jul-04-2019, 05:31 PM
RE: Help to understand my mistake - by snippsat - Jul-04-2019, 06:09 PM
RE: Help to understand my mistake - by TeeMan - Jul-05-2019, 10:57 AM
RE: Help to understand my mistake - by micseydel - Jul-04-2019, 11:06 PM
RE: Help to understand my mistake - by noisefloor - Jul-05-2019, 11:58 AM
RE: Help to understand my mistake - by TeeMan - Jul-05-2019, 01:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Solved] Please, help me find a simple mistake AlekseyPython 2 1,800 Jun-17-2021, 12:20 PM
Last Post: AlekseyPython
  [split] Could you please clarify where i did mistake also how run without admin right Abubakkar 1 1,819 Jun-14-2021, 09:32 AM
Last Post: Larz60+
  Please help to me to find my mistake in code leonardin 2 1,901 Nov-29-2020, 04:17 PM
Last Post: Larz60+
  minor mistake in code for factorial spalisetty06 2 1,944 Aug-22-2020, 05:00 PM
Last Post: spalisetty06
  Simple mistake about for Nomatter 4 2,355 Jul-16-2020, 02:24 PM
Last Post: Nomatter
  Install Mistake jlerette5 1 1,939 Feb-18-2020, 12:19 AM
Last Post: jefsummers
  What was my mistake in this Python code (easy)? voltman 4 3,524 Nov-19-2019, 09:58 PM
Last Post: snippsat
  countdown script not working..plz help what is mistake randyjack 1 2,155 Oct-28-2019, 06:57 AM
Last Post: perfringo
  Beginner mistake. bbweeg 1 2,094 Aug-17-2019, 07:27 AM
Last Post: perfringo
  Need to find a mistake in my code boris602 3 3,215 Jan-11-2018, 01:49 PM
Last Post: boris602

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020