This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Trying to build with Ninja results nrfjprog.py in an AttributeError.

I am able to build my project, but when I try to flash it to the board via ninja flash_<target> I can select the device in nrfjprog.py, I know, that I have to use "'0'" as input, so that the script doesn't result in an error, but then I get the following error:

nrf5_SDK_for_Mesh_v4.0.0_src/CMake/nrfjprog.py", line 93, in main
with multiprocessing.Pool(len(devices)) as p:
AttributeError: __exit__

Is there a way to fix this?

  • Hello Hung,

    I just testet this on a machine with higher cmake package. We also have to actually set PYTHON_EXECUTABLE in the else-Part, because when searching for package Python3, cmake will set Python3_EXECUTABLE, where in the cmake-scripts it is checked for the existance of PYTHON_EXECUTABLE. So the code has to be the following:

    # Needed tools for generating documentation and serial PyACI
    if(CMAKE_VERSION VERSION_LESS 3.12)
        find_package(PythonInterp 3 REQUIRED)
    else ()
        find_package(Python3)
        SET(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
    endif()

Related