Pythonista-Issues
Pythonista-Issues copied to clipboard
Pythonista doesn't catch SystemExit exception
The following python script gives the expected output on Python 3.10 (and other versions) on MacOS, but not in Pythonista 3 (version 3.4).
import sys
print('''
This should print:
Start
Caught SystemExit: Test
After Exit
''')
try:
print('Start')
sys.exit('Test')
print('This should not be printed')
except SystemExit as e:
print('Caught SystemExit: ', e)
print('After Exit')
If SystemExit is replaced by BaseException, it works.