poker_ai icon indicating copy to clipboard operation
poker_ai copied to clipboard

Fix Issue #108

Open alexandermaas opened this issue 4 years ago • 3 comments

…stions/60691363/runtimeerrorfreeze-support-on-mac#:~:text=This%20probably%20means%20that%20you,frozen%20to%20produce%20an%20executable.

alexandermaas avatar Nov 23 '20 07:11 alexandermaas

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 23 '20 07:11 CLAassistant

I've added the code changes to local copy and I'm still getting the following runtime error

RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

kabua avatar Aug 03 '21 15:08 kabua

I found a very simple solution (comment by Ofer) that works on windows (and perhaps on other OSes as well).

In bin\poker_ai, move the condition to the top of the code, like so:

#!/usr/bin/env python

if __name__ == "__main__":
    from poker_ai.cli.runner import cli
    cli()

kabua avatar Aug 03 '21 16:08 kabua