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

when starting nrfutil.exe after build from source: import error (due to invalid module)

Hello

I simply wanted to build an executable from a customized nrfutil. Ran the "pyinstaller nrfutil.spec" and afterwards started the nrfutil.exe from command line. This reported the import error "no module named package". After ensuring that the module exists, and after adding the path explicitly to the pathex variable in the .spec file, ths error remained. Having a look into the "warn-nrfutil.txt" i noticed that the module warning was written as "invalid module named package" and not "missing module named package". It seems that pyinstaller had found the module but classified it as invalid.

As a next step, I wanted to see if the error can be reproduced on another pc with a new and clean installation of the python environment and an untouched download of the latest nrfutil release's source from GitHub. The result was similar but not exactly the same.

Version of python: 2.7.16 (installed using the miniconda 2 installer)

Source for nrfutil: v6.0 (release from GitHub)

Step 1: Build Exe with "pyinstaller nrfutil.spec"

Step 2: Run Exe in subdirectory "dist"

---> Command Shell: ImportError: No module named crc16

---> warn-nrfutil.txt: invalid module named nordlicsemi.dfu.crc16

What is the reason for that?

Parents Reply
  • Hi Vidar

    I did some tries and have to confirm: option b) is NOT required for c). I mixed up things because while I was executing b) I was fixing some bugs in my source which actually were the reason for the module to be classified as "invalid" (and not the fact that I omitted b). And then, to make it more confusing: A conda environment with pytion v3.7.2 was enabled at the time when I made it working, not being aware of it. Sorry for the wrong conclusions.

Children
Related