I had a similar problem with my employee, which was loading some data, generating a graph and saving it in a file. Note that this is slightly different from the OP case, which seems to be oriented towards interactive plotting. However, I find this relevant.
A simplified version of my code:
def worker(id): data = load_data(id) plot_data_to_file(data)
This caused the same error that others are talking about:
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec(). Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
Following @bbbruce's thinking, I solved my problem by switching the matplotlib backend from TKAgg to the default value. In particular, I commented on the following line in the matplotlibrc file:
source share