Oddly, in debug mode, if the script is stopped (via a breakpoint) where the segfault would normally occur (without the breakpoint), and then resumed, the segmentation fault will not happen. Very strange right?
This project uses pycharm and pygame. The OS is windows 10. This project contains ~1500 lines of code across 8 modules, and debugging worked great until now.
The segmentation fault does not happen when running the script normally (not in debug). Here is the output of the terminal when a seg fault occurs:
Fatal Python error: pygame_parachute: (pygame parachute) Segmentation Fault
Python runtime state: initialized
#some other threads here
Thread 0x0000490c (most recent call first):
... a long stack trace
Thread 0x00002c98 (most recent call first):
... a long stack trace
Thread 0x000048ec (most recent call first):
... a long stack trace
Current thread 0x000020d0 (most recent call first):
File "C:\Users\Solaire\PycharmProjects\Game2\ai.py", line 60 in do_ai
**File "C:/Users/Solaire/PycharmProjects/Game2/main.py", line 45 in <module>**
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18 in execfile
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1483 in _exec
Extension modules:
...lots of extensions...
Process finished with exit code -1073740791 (0xC0000409)
The only thing I can think of right away is the use of forward slashes for the module main.py . The stack frame below it seems to consider filenames:
#execute the script (note: it's important to compile first to have the filename set in debug mode)
exec(compile(contents+"\n", file, 'exec'), glob, loc)
Is the debugger getting the filename wrong? That's the only hint I have. I'm new to python development. Even if you don't have a complete answer, any help/tips would be greatly appreciated.