I have been using the Mathematica client library for Python, but it errors at random some times when running the program, returning:
wolframclient.exception.WolframKernelException: Failed to communicate with kernel: C:\Program Files\Wolfram Research\Mathematica\13.3\WolframKernel.exe.
Whenever this happens, simply running the program again works just fine, and the Mathematica part of the program works just fine. Maybe 1/10 times, this error will run and I'll just restart the program. It's pretty annoying, and seems to happen totally at random.
The python program I'm running is relatively long, but the place where Mathematica shows up is pretty short:
session=WolframLanguageSession()
null_space=np.array(session.evaluate(wlexpr(generating_string)))
session.terminate()
Moreover, I added code at the beginning that simply loads the session by and evaluates Range[5] then terminates it so as to catch an error at the beginning. However, the code seems to run fine at the beginning but then be unable to communicate with the kernel later on in the same run of the program. Again, just restarting the program lets it run fine.
Any idea what's going on or how this could be fixed?