Looks like the script is simply setting a tuple at line 23, so it’s not obvious why Python dumped core. I find it curious that the core dump happened right after some checks for how the hook was compiled. Does the node where your job is running share the exact same instruction set as the node where you run the script manually. Is it possible the Python extension was compiled for an incompatible processor capability?
Try using “qsub -I” (interactive job) if you need to debug it further. Do you have a backtrace from gdb when you examine the core file?