The code in question:
print('s')
y=1/0
In which I understand the error perfectly (it's just division by zero), causes, when ran (while on PyCharm, by pressing shift+f10, the normal way) either the following output:
C:\Users\myname\PycharmProjects\test1\.venv\Scripts\python.exe C:\Users\myname\PycharmProjects\test1\Functions\error.py
Traceback (most recent call last):
File "C:\Users\myname\PycharmProjects\test1\Functions\error.py", line 2, in <module>
y=1/0
~^~
ZeroDivisionError: division by zero
s
Process finished with exit code 1
Or this one (and now note that the printed 's' appears before the traceback instead of after:
C:\Users\myname\PycharmProjects\test1\.venv\Scripts\python.exe C:\Users\myname\PycharmProjects\test1\Functions\error.py
s
Traceback (most recent call last):
File "C:\Users\myname\PycharmProjects\test1\Functions\error.py", line 2, in <module>
y=1/0
~^~
ZeroDivisionError: division by zero
Process finished with exit code 1
This is a bug. I have had this issue in programs with many more statements and sometimes the traceback is hidden before them.
I tried searching similar questions, but they don't focus on if it's important or not the order shown of the output if there is a traceback, and don't have so simple errors, and they are older.