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

How to run nrfutil in a container to maintain the python2 installation.

I have python 2 and 3 on my Macbook.  I can't run nrfutil which I believe is due to the python installation.  I need to keep python 3 for other utilities. I would like to run nrfutil in a container with the correct python configuration.

Running nrfutil is producing errors as shown.

nrfutil keys generate private.pem
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==3.5.1', 'console_scripts', 'nrfutil')()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nordicsemi/__main__.py", line 321, in generate
    signer.gen_key(key_file)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nordicsemi/dfu/signing.py", line 79, in gen_key
    sk_file.write(self.sk.to_pem())
TypeError: write() argument must be str, not bytes

Related