Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork error on MacOS #4

Open
garysb opened this issue Nov 4, 2020 · 1 comment
Open

Fork error on MacOS #4

garysb opened this issue Nov 4, 2020 · 1 comment

Comments

@garysb
Copy link

garysb commented Nov 4, 2020

When running in standalone mode on MacOS, having a window open another window causes the following error:

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.

This seems to be related to the _MultiAppLaunch class within standalone.py

@huntfx
Copy link
Owner

huntfx commented Nov 4, 2020

I googled the error and it seems to be a bug with the multiprocessing module.

I'm not sure if this line is Python 3 specific, but this apparently solves it if you were to add it to the top of the file:

if platform.system() == 'Darwin':
    multiprocessing.set_start_method('spawn')

There's also a workaround someone came up with in case you're using Python 2, I can't tell if it'll be of any help though.

If you were to use win.show(instance=True), then it will not spawn a new process, but as a downside certain things will be shared between the windows such as the palette. If you're working in Python 3 and the top solution works for you, I'll just default this to True for MacOS Py2 to avoid the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants