New answers tagged

1

It seems that replacing Quit[] with CloseKernels[]; Pause[5]; Quit[] solves the issue as pointed out in a comment to a related question.


1

I would also recommend using ExternalEvaluate for this kind of interaction with python. But you can keep everything the way you have it with just a small change. First I add a print statement at the end of the python script to signal when it has finished writing the file, just something like print("finished") Then call ReadLine[process] after the ...


2

Look at ExternalEvaluate if you have v12.0? The python computations will by design be 'blocking' using this approach, i.e. the Wolfram Kernel will wait on the ExternalEvaluate to finish. Here's your simple example using TemplateExpression: session = StartExternalSession["Python"]; ExternalEvaluate[session, " x = <* x *> y = <* y *> ...


Top 50 recent answers are included