While trying some unittests I was surprised to find that the -i command-line option would not keep the interpreter running. Bill Bumgarner pointed out to me that "-i doesn't deal with sys.exit. The last line of the runTests() method in the unittest module invokes sys.exit()." Bill also suggested that if I wanted to keep the interpreter up in the case of the unittest I could do so with: if __name__ == '__main__': try: unittest.main() except SystemExit: pass But the core issue to me is that if you invoke the Python interpreter with -i, then even sys.exit shouldn't kill the interpreter, especially since sys.exit generates an exception which can be caught. I can't think of any other case where -i fails to keep the interpreter alive after a script exits, whether because of an syntax or runtime error or normal termination. The interpreter help states: -i : inspect interactively after running script, (also PYTHONINSPECT=x) and force prompts, even if stdin does not appear to be a terminal So should the sys.exit behavior with the -i command-line option be considered a bug or a feature? ;-) I'm happy to enter a report to get the behavior changed if possible. ka --- Kevin Altis altis@semi-retired.com http://radio.weblogs.com/0102677/ http://www.pythoncard.org/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4