As in Python 3, with try, execute the command, but in except, output an error and continue the execution of the program.
Example:
error= ' ' try: print (str(1/0)) except: error = 'ΠΎΡΠΈΠ±ΠΊΠ° Π½ΠΎΠΌΠ΅Ρ ....' print("ΠΎΡΠΈΠ±ΠΊΠ° Ρ ΡΠ΅ΠΊΡΡΠΎΠΌ, ΡΡΡΠΎΠΊΠ°, Π»ΠΈΠ½ΠΈΡ ΠΈ Ρ.ΠΏ. ΡΠΈΠΏ ΠΎΡΠΈΠ±ΠΊΠΈ(ΡΡΠΎ ΠΏΠΈΡΠ΅Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡ): "+str(error)) #ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠ°Π΅Ρ ΠΈΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ try: print (str(0/0)) except: error = 'ΠΎΡΠΈΠ±ΠΊΠ° Π½ΠΎΠΌΠ΅Ρ ....' print("ΠΎΡΠΈΠ±ΠΊΠ° Ρ ΡΠ΅ΠΊΡΡΠΎΠΌ, ΡΡΡΠΎΠΊΠ°, Π»ΠΈΠ½ΠΈΡ ΠΈ Ρ.ΠΏ. ΡΠΈΠΏ ΠΎΡΠΈΠ±ΠΊΠΈ(ΡΡΠΎ ΠΏΠΈΡΠ΅Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡ): "+str(error)) #ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠ°Π΅Ρ ΠΈΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ try: print (str(1+1)) except: error = 'ΠΎΡΠΈΠ±ΠΊΠ° Π½ΠΎΠΌΠ΅Ρ ....' print("ΠΎΡΠΈΠ±ΠΊΠ° Ρ ΡΠ΅ΠΊΡΡΠΎΠΌ, ΡΡΡΠΎΠΊΠ°, Π»ΠΈΠ½ΠΈΡ ΠΈ Ρ.ΠΏ. ΡΠΈΠΏ ΠΎΡΠΈΠ±ΠΊΠΈ(ΡΡΠΎ ΠΏΠΈΡΠ΅Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡ): "+str(error)) 

except Exception as exc: print(exc)for starters - andreymalexcept:almost never need to write, since you risk losing the ability to shut down the program properly (SystemExit and KeyboardInterrupt exceptions are caught) - andreymal