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

nRF9160 SDK compile error

Hello guys

I am trying to compile the latest nrf sdk with version v1.2.0 it fails with the following error

but when i compile either v1.0.0 or v1.1.0 it is successfully compiled

only v1.2.0 gives me this error any help please

root@ELB-iSCADA8m:/home/nick/Desktop/v1.2/nrf/samples/nrf9160/at_client# west build -b nrf9160_pca10090ns
Traceback (most recent call last):
  File "/root/.local/bin/west", line 8, in <module>
    sys.exit(main())
  File "/root/.local/lib/python3.5/site-packages/west/main.py", line 583, in main
    args.handler(args, unknown)
  File "/root/.local/lib/python3.5/site-packages/west/main.py", line 324, in ext_command_handler
    command = spec.factory()
  File "/root/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 365, in __call__
    mod = _commands_module_from_file(self.py_file)
  File "/root/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 333, in _commands_module_from_file
    mod = _import_mod_from(mod_name, file)
  File "/root/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 330, in _import_mod_from
    spec.loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/nick/Desktop/v1.2/zephyr/scripts/west_commands/build.py", line 15, in <module>
    from zephyr_ext_common import Forceable
  File "/home/nick/Desktop/v1.2/zephyr/scripts/west_commands/zephyr_ext_common.py", line 14, in <module>
    from runners.core import RunnerConfig
  File "/home/nick/Desktop/v1.2/zephyr/scripts/west_commands/runners/__init__.py", line 25, in <module>
    from runners import nrfjprog
  File "/home/nick/Desktop/v1.2/zephyr/scripts/west_commands/runners/nrfjprog.py", line 86
    f'refusing to guess which of {len(snrs)} '
                                             ^
SyntaxError: invalid syntax

  • Have you remembered to run west update after checking out tag v1.2.0? Open a terminal in Desktop/v1.2/nrf and run the following commands:

    git checkout v1.2.0
    west update

    Best regards,

    Simon

  • Hi simon,

                   I am facing the same issue while running the west command. I have tried the above mentioned commands but the error is not resolved. Can you tell me the other solution if possible.

    Thanks and regards,

    Shammi

    shammi@shammi-Ideapad-Z560:~/work/IoT/Zephyr/zephyrproject/zephyr$ west build -p auto -b reelboard samples/basic/blinky
    Traceback (most recent call last):
      File "/home/shammi/.local/bin/west", line 8, in <module>
        sys.exit(main())
      File "/home/shammi/.local/lib/python3.5/site-packages/west/main.py", line 583, in main
        args.handler(args, unknown)
      File "/home/shammi/.local/lib/python3.5/site-packages/west/main.py", line 324, in ext_command_handler
        command = spec.factory()
      File "/home/shammi/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 365, in __call__
        mod = _commands_module_from_file(self.py_file)
      File "/home/shammi/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 333, in _commands_module_from_file
        mod = _import_mod_from(mod_name, file)
      File "/home/shammi/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 330, in _import_mod_from
        spec.loader.exec_module(mod)
      File "<frozen importlib._bootstrap_external>", line 665, in exec_module
      File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
      File "/home/shammi/work/IoT/Zephyr/zephyrproject/zephyr/scripts/west_commands/build.py", line 16, in <module>
        from zephyr_ext_common import Forceable
      File "/home/shammi/work/IoT/Zephyr/zephyrproject/zephyr/scripts/west_commands/zephyr_ext_common.py", line 17, in <module>
        from runners.core import RunnerConfig
      File "/home/shammi/work/IoT/Zephyr/zephyrproject/zephyr/scripts/west_commands/runners/__init__.py", line 25, in <module>
        from runners import nrfjprog
      File "/home/shammi/work/IoT/Zephyr/zephyrproject/zephyr/scripts/west_commands/runners/nrfjprog.py", line 86
        f'refusing to guess which of {len(snrs)} '
                                                 ^
    SyntaxError: invalid syntax
    shammi@shammi-Ideapad-Z560:~/work/IoT/Zephyr/zephyrproject/zephyr$ west build -p auto -b reelboard samples/basic/blinky
    Traceback (most recent call last):
      File "/home/shammi/.local/bin/west", line 8, in <module>
        sys.exit(main())
      File "/home/shammi/.local/lib/python3.5/site-packages/west/main.py", line 583, in main
        args.handler(args, unknown)
      File "/home/shammi/.local/lib/python3.5/site-packages/west/main.py", line 324, in ext_command_handler
        command = spec.factory()
      File "/home/shammi/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 365, in __call__
        mod = _commands_module_from_file(self.py_file)
      File "/home/shammi/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 333, in _commands_module_from_file
        mod = _import_mod_from(mod_name, file)
      File "/home/shammi/.local/lib/python3.5/site-packages/west/commands/__init__.py", line 330, in _import_mod_from
        spec.loader.exec_module(mod)
      File "<frozen importlib._bootstrap_external>", line 665, in exec_module
      File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
      File "/home/shammi/work/IoT/Zephyr/zephyrproject/zephyr/scripts/west_commands/build.py", line 16, in <module>
        from zephyr_ext_common import Forceable
      File "/home/shammi/work/IoT/Zephyr/zephyrproject/zephyr/scripts/west_commands/zephyr_ext_common.py", line 17, in <module>
        from runners.core import RunnerConfig
      File "/home/shammi/work/IoT/Zephyr/zephyrproject/zephyr/scripts/west_commands/runners/__init__.py", line 25, in <module>
        from runners import nrfjprog
      File "/home/shammi/work/IoT/Zephyr/zephyrproject/zephyr/scripts/west_commands/runners/nrfjprog.py", line 86
        f'refusing to guess which of {len(snrs)} '
                                                 ^
    SyntaxError: invalid syntax
    

  • Oooh. I think I know what's causing the issue, I was maybe too quick to answer earlier. There is a syntax error in the file ncs\zephyr\scripts\west_commands\runners\nrfjprog.py.

    In nrfjprog.py-->NrfJprogBinaryRunner()-->get_board_snr()-->elif not sys.stdin.isatty() change it from:

    elif not sys.stdin.isatty():
                raise RuntimeError(
                    f'refusing to guess which of {len(snrs)} '

    to:

    elif not sys.stdin.isatty():
                raise RuntimeError(
                    'refusing to guess which of {len(snrs)} '

    It's strange that I'm not getting that issueThinking I am using Python v3.8, try updating to that.

    I would recommend you to use the Toolchain Manager, since everything runs out of the box, and the chances of encountering any errors are minimal.

    Best regards,

    Simon

Related