Skip to content

Compilation fails with "RuntimeError: Click will abort further execution because Python was configured to use ASCII as encoding for the environment" #5

@nitram509

Description

@nitram509

Hi,

I'm using the latest version 1.0.2 and getting this compiler error, no matter what example code I want to compile.

Using ArduinoIDE 2.3.7, and having managed to add the Board Manager, as recommended by comments in issue #1 .

This is the verbose log output:

[...redacted...]
/Users/USERNAME/Library/Arduino15/packages/nRFMicro-like-boards/hardware/nrf52/1.0.2/tools/adafruit-nrfutil/macos/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0x0123 --application /Users/USERNAME/Library/Caches/arduino/sketches/E78EA9DBCBBD858CE497055CF19474BC/sketch_jan2a.ino.hex /Users/USERNAME/Library/Caches/arduino/sketches/E78EA9DBCBBD858CE497055CF19474BC/sketch_jan2a.ino.zip
Traceback (most recent call last):
  File "__main__.py", line 317, in <module>
  File "click/core.py", line 1134, in __call__
  File "click/core.py", line 1040, in main
  File "click/_unicodefun.py", line 100, in _verify_python_env
RuntimeError: Click will abort further execution because Python was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/unicode-support/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8
[13061] Failed to execute script __main__
exit status 1

Compilation error: exit status 1

I found a solution to make this work: I had to re-compile the adafruit-nrfutil from source, with the latest version of click.
In summary, I did:

  • cloned the repo https://github.com/adafruit/Adafruit_nRF52_nrfutil (branch: master)
  • using Python 3.12.4 (a version I had installed locally; and actually created a fresh venv to avoid tainted dependencies)
  • created a fresh single-binary (as described in the tool's README)
  • copied the newly created adafruit-nrfutil to the folder /Users/USERNAME/Library/Arduino15/packages/nRFMicro-like-boards/hardware/nrf52/1.0.2/tools/adafruit-nrfutil/macos --> then the compilation of my sketch worked

May I ask you @pdcook to release a new version of nRFMicro-Arduino-Core, with an updated adafruit-nrfutil binary, please?
I also suggest to upgrade the Github Action to use Python v3.12.x to benefit from performance improvements in the Python runtime.

For the record, these are the versions of the dependencies used (as of today):

Package                   Version
------------------------- -------
altgraph                  0.17.5
behave                    1.3.3
click                     8.3.1
colorama                  0.4.6
cucumber-expressions      18.0.1
cucumber-tag-expressions  8.1.0
ecdsa                     0.19.1
macholib                  1.16.4
packaging                 25.0
parse                     1.20.2
parse_type                0.6.6
pip                       24.0
pyinstaller               6.17.0
pyinstaller-hooks-contrib 2025.11
pyserial                  3.5
setuptools                80.9.0
six                       1.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions