I'm writing a python (v. 3.9) program intended to be run in interactive mode. Program needs an argument to run properly. So, I try to check if the argument is present or if it is not in order to continue with the following lines:
import sys
if (len(sys.argv) >= 2):
prefix=sys.argv[1]
else :
print(" Usage: python -i my_program.py one_argument")
quit()
But it just shows an error message and does not exit. I have tried also
exit()
sys.exit()
type(quit())
(in place of quit()
) with the same result.
Is it possible to program in advance quitting in interactive mode?