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

Unable to generate dfu_package.zip using nrfutil

Hi,

I am not able generate dfu_package.zip using nrfutil.

I am using ubuntu 18.04, and python2.7 is installed is default python version. 

I get the following error when I try to generate dfu_package.zip.

Traceback (most recent call last):
  File "/home/rakesh/.local/bin/nrfutil", line 11, in <module>
    sys.exit(cli())
  File "/home/rakesh/.local/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/rakesh/.local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/rakesh/.local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rakesh/.local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rakesh/.local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rakesh/.local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/rakesh/.local/lib/python3.6/site-packages/nordicsemi/__main__.py", line 815, in generate
    default_key = signer.load_key(key_file)
  File "/home/rakesh/.local/lib/python3.6/site-packages/nordicsemi/dfu/signing.py", line 92, in load_key
    sk_hex = "".join(c.encode('hex') for c in self.sk.to_string())
  File "/home/rakesh/.local/lib/python3.6/site-packages/nordicsemi/dfu/signing.py", line 92, in <genexpr>
    sk_hex = "".join(c.encode('hex') for c in self.sk.to_string())
AttributeError: 'int' object has no attribute 'encode

Thank you,

Rakesh

Parents
  • Hi,

    According to the error messages you are using python 3.6 and not python 2.7. How did you install nrfutil, and what do you get from "nrfutil version"?

    Regards,
    Terje

  • Yes, nrfutil was installed in python3.6/site packages. I installed nrfutil using pip, and my system's default python version is 2.7.15+ . Using pip install nrfutil, should have installed nrfutil in python2.7/site package folder, right?

    Now I have manually deleted the nrfutil from python3.6/site-packges, and reinstalled it again. Guess what, this time nrfutil is installed in python2.7/dist-package folder, and when I run "nrfutil --help" in the terminal, I get the following error

    /home/rakesh/.local/bin/nrfutil: No such file or directory

    Thank you

  • Hi,

    Now that looks a bit strange, that it looks at a specific location like that without finding anything. Can you check if there is an executable "nrfutil" at that path? (You can for instance use the command "ls -lh /home/rakesh/.local/bin/nrfutil" to list all information about the file. (The -l flag is small letter L, and not  big letter i, number 1, or pipe |. Sorry for difficult font here on DevZone.)

    You can also find out where nrfutil is located by running the command "updatedb" (to update a file path database) and then the command "locate nrfutil".

    The command "which nrfutil" will display the path will be executed when running "nrfutil". From the error message that you get that will probably return "/home/rakesh/.local/bin/nrfutil". You can also use that command later to see if an attempted fix has actually done something.

    We have seen previously on UNIX like platforms that after installing nrfutil the PATH environment variable has not been updated. Either just for the active terminal, or in general. It may be worth checking that as well, i.e. close and reopen the terminal, and check the PATH environment variable.

    Regards,
    Terje

Reply
  • Hi,

    Now that looks a bit strange, that it looks at a specific location like that without finding anything. Can you check if there is an executable "nrfutil" at that path? (You can for instance use the command "ls -lh /home/rakesh/.local/bin/nrfutil" to list all information about the file. (The -l flag is small letter L, and not  big letter i, number 1, or pipe |. Sorry for difficult font here on DevZone.)

    You can also find out where nrfutil is located by running the command "updatedb" (to update a file path database) and then the command "locate nrfutil".

    The command "which nrfutil" will display the path will be executed when running "nrfutil". From the error message that you get that will probably return "/home/rakesh/.local/bin/nrfutil". You can also use that command later to see if an attempted fix has actually done something.

    We have seen previously on UNIX like platforms that after installing nrfutil the PATH environment variable has not been updated. Either just for the active terminal, or in general. It may be worth checking that as well, i.e. close and reopen the terminal, and check the PATH environment variable.

    Regards,
    Terje

Children
No Data
Related