In the all-in-one-Python-script use case, we have some top-level driver code that sets up the simulation and then calls runner.run_simulation(). The latter creates a new process for each required instance. On GNU/Linux, that forks, but on MacOS and possibly Windows, it spawns. Spawning starts a new Python interpreter, which loads all the modules, and that executes the top-level code again. The interpreter catches this, and crashes with an error message.
This isn't a bug in MUSCLE3 per se, but we should check that the examples all have an if __name__ == '__main__' around that top level code, and add a comment telling users not to remove it and why.
In the all-in-one-Python-script use case, we have some top-level driver code that sets up the simulation and then calls
runner.run_simulation()
. The latter creates a new process for each required instance. On GNU/Linux, that forks, but on MacOS and possibly Windows, it spawns. Spawning starts a new Python interpreter, which loads all the modules, and that executes the top-level code again. The interpreter catches this, and crashes with an error message.This isn't a bug in MUSCLE3 per se, but we should check that the examples all have an
if __name__ == '__main__'
around that top level code, and add a comment telling users not to remove it and why.