Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

python3.7:nrfutil keys generate private.key error #260

Closed
jiangdailun opened this issue Oct 10, 2019 · 7 comments
Closed

python3.7:nrfutil keys generate private.key error #260

jiangdailun opened this issue Oct 10, 2019 · 7 comments

Comments

@jiangdailun
Copy link

I use "nrfutil keys generate private.key",but there is a mistake
Traceback (most recent call last):
File "/usr/local/bin/nrfutil", line 10, in
sys.exit(cli())
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/nordicsemi/main.py", line 434, in generate
signer.gen_key(key_file)
File "/usr/local/lib/python3.7/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

@bihanssen
Copy link
Contributor

We're not able to reproduce. Also the line number in main.py does not correspond with what's in master currently. Make sure that all code is up to date. Reopen if you still see the problem.

@akamensky
Copy link

@bihanssen I have same exact error.

Python 3.7. nrfutil installed from pip as directed on Nordic website. Version 6.0.1.

I don't think just outright closing this issue without asking for any additional info is a good idea...

@akamensky
Copy link

It appears that pypi.org has very different code versions for Python2 and Python3, even command line arguments are different...

Installing nrfutil for Python2 does work. Python3 it fails to generate key.

@bihanssen
Copy link
Contributor

@akamensky, I will reopen the issue so it can be looked further into.

Note, if you run pip install with python 2 (ref your latest comment) you will get nrfutil v5.2.0. Could that be the reason you are seeing very different code version?

@bihanssen bihanssen reopened this Mar 9, 2020
@akamensky
Copy link

Correct, I missed that, python2 pip installed 5.2.0 version.

I have not tried installing from sources directly.

@bihanssen
Copy link
Contributor

Unless more info is provided on this I will assume the problem is mixing of versions 5.2 and 6, which mark the change from python 2 to 3.
Causes that can lead to the problem are that
1: nrfutil 5.2 does not disallow installation with python 3 even though it does not support python 3,
2: the ble-driver-py dependency does not support pip < v20, which can lead to unfortunate fallback to version 5.2.

@kenr
Copy link
Contributor

kenr commented Jan 17, 2023

We do not have capacity to maintain and release new versions of this utility.
A new utility with the same name will cover this feature. It can be found here: https://www.nordicsemi.com/Products/Development-tools/nrf-util

@kenr kenr closed this as completed Jan 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants