Python Forum
Error message when running autostarted code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error message when running autostarted code
#3
Hi Unladen Swallow

Section of code which creates error message is below:

The EOF error traces to the section marked as XXXXX, immediately after entering * at keyboard.
#Select required action using the selected Trap Release Table defined in mgc_start( )        
def pull( ): 
    while True:
        global table
        print  ("Table " + (table))  #de-bug code
        arm1 = ( )
        arm2 = ( )
        arm3 = ( )
        arm4 = ( )
        arm1 = 1  #1 = Trap not armed, 0 = Trap armed
        arm2 = 1  #1 = Trap not armed, 0 = Trap armed
        arm3 = 1  #1 = Trap not armed, 0 = Trap armed
        arm4 = 1  #1 = Trap not armed, 0 = Trap armed
        pull = ( )
        pull = input ("\nPRESS '*' TO START SELECTED  RELEASE TYPE"
        "\nPRESS '/' TO RETURN TO 'SELECT  RELEASE' "
        "\nPRESS '-' TO FINISH  AND SHUTDOWN SYSTEM\n")

XXXXX
        if pull  == ("*"):  #Start Trap Release Sequence when  PB pressed
            arm1 = GPIO.input(32)
            arm2 = GPIO.input(36)
            arm3 = GPIO.input(38)
            arm4 = GPIO.input(40)
            print ("TRAP ARM STATUS = " + str(arm1) + str(arm2) + str(arm3) + str(arm4))
            print ("RELEASE TABLE SELECTED  = " + str(table))
            
            if  not (arm1) and not (arm2) and (str(table) == "1" or str(table) == "2" \
                    or str(table) == "3"):
                print ("A") #de-bug code 
                print ("\nPRESS BUTTON TO FIRE 1st Release FROM TABLE " + str(table))
                flush_random( )  #go to check if flush selected
                #mgc_start( )  #de-bug code
                
            elif not (arm1) and not (arm2) and not (arm3) and (str(table) == "4" \
                    or str(table) == "5" or str(table) == "6" or str(table) == "10"  \
                    or str(table) == "12"):
                print ("B") #de-bug code 
                print ("\nPRESS FIRE BUTTON TO FIRE 1st  FROM TABLE " + str(table))
                flush_random( )  #go to check if flush selected
                #mgc_start( )  #de-bug code
                
            elif not (arm1) and not (arm2) and not (arm3) and not (arm4)  \
                 and (str(table) == "7" or str(table) == "8" or str(table) == "9" \
                      or str(table) == "11" or str(table) == "13" or str(table) == "14"):
                print("C")  #de-bug code
                print ("\nPRESS FIRE BUTTON TO FIRE 1st release FROM TABLE " + str(table))
                flush_random( )  #go to check if flush selected
                #mgc_start( )  #de-bug code
                
            else:  #Invalid selected release type re number of traps armed and ready
                print ("INVALID RELEASE TYPE RE TRAPS ARMED AND READY")
                print ("ARM REQUIRED TRAPS & RESELECT RELEASE TYPE")
                mgc_start()

        elif pull == ("/"):  #Change request clay release type from previous choice
            print ("\nRETURNING TO  'SELECT RELEASE TYPE' ")
            mgc_start( )  #Runs mgc_start( ) code again

        elif pull == ("-"):  #Finished with Trap Control Box, Shut Down System
            print("\nSHUTING SYSTEM DOWN")
            print("WAIT UNTIL RUN LIGHT IS OFF BEFORE UNPLUGING POWER")
            GPIO.output(7, 0)  #Trap 1 = 0
            GPIO.output(11, 0)  #Trap 2 = 0
            GPIO.output(13, 0)   #Trap 3 = 0
            GPIO.output(15, 0)  #Trap 4 = 0
            GPIO.output(29, 0)  #System Ready LED = OFF
            GPIO.output(31, 0)  #Fire Pushbutton Disabled (Safety feature)
            GPIO.output(33, 0)  #Flush Pushbutton Disabled (Safety feature)
            GPIO.cleanup( )
            sys.exit( )  #Finished with Trap Control Box, Shut Down System
    
        else:  #Invalid request, therefore try again
            print("\nINVALID INPUT, PRESS '*' OR '/' OR '-' TO CONTINUE")
            continue  #Returns to beginning of pull( ) loop

Hi unladen Swallow
Sorry re code supplied, all the indents seem to have disappeared during cut and paste

Hi DeaD_EyE
Sorry I sent reply to "Unladen Swallow instead of to you.
This is my first time use of this python problem system so I may get the protocols wrong!
Reply


Messages In This Thread
RE: Error message when running autostarted code - by Python4Mike - Jan-31-2018, 03:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem in running a code akbarza 7 781 Feb-14-2024, 02:57 PM
Last Post: snippsat
  writing and running code in vscode without saving it akbarza 1 464 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  the order of running code in a decorator function akbarza 2 598 Nov-10-2023, 08:09 AM
Last Post: akbarza
  error "cannot identify image file" part way through running hatflyer 0 762 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  Error message about iid from RandomizedSearchCV Visiting 2 1,095 Aug-17-2023, 07:53 PM
Last Post: Visiting
  Error when running kivy on python janeik 8 2,238 Jun-16-2023, 10:58 PM
Last Post: janeik
  Another Error message. the_jl_zone 2 1,031 Mar-06-2023, 10:23 PM
Last Post: the_jl_zone
  Getting error when running "MINUS" between 2 databases marlonbown 4 1,364 Nov-10-2022, 05:49 AM
Last Post: deanhystad
  Code running many times nad not just one? korenron 4 1,438 Jul-24-2022, 08:12 AM
Last Post: korenron
  Error while running code on VSC maiya 4 3,962 Jul-01-2022, 02:51 PM
Last Post: maiya

Forum Jump:

User Panel Messages

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