adafruit / Adafruit_nRF52_Arduino

Adafruit code for the Nordic nRF52 BLE SoC on Arduino
Other
598 stars 488 forks source link

Unicode/locale error on MacOS and Arduino 2.0.0 #743

Closed exipilis closed 7 months ago

exipilis commented 1 year ago

Operating System

MacOS

IDE version

2.0.0

Board

Feather nRF52840 Sense

BSP version

1.3.0

Sketch

Blink

What happened ?

With Arduino IDE 1.8.x nRF52 boards compile successfully. With Arduino IDE 2.0.0 ARM and AVR boards compile successfully. With Arduino IDE 2.0.0 and nRF52 I get this while compiling the sketch:

Traceback (most recent call last): File "main.py", line 317, in 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 lists some UTF-8 supporting locales that you can pick from. The following suitable locales were discovered: af_ZA.UTF-8, am_ET.UTF-8, be_BY.UTF-8, bg_BG.UTF-8, ca_ES.UTF-8, cs_CZ.UTF-8, da_DK.UTF-8, de_AT.UTF-8, de_CH.UTF-8, de_DE.UTF-8, el_GR.UTF-8, en_AU.UTF-8, en_CA.UTF-8, en_GB.UTF-8, en_IE.UTF-8, en_NZ.UTF-8, en_US.UTF-8, es_ES.UTF-8, et_EE.UTF-8, eu_ES.UTF-8, fi_FI.UTF-8, fr_BE.UTF-8, fr_CA.UTF-8, fr_CH.UTF-8, fr_FR.UTF-8, he_IL.UTF-8, hr_HR.UTF-8, hu_HU.UTF-8, hy_AM.UTF-8, is_IS.UTF-8, it_CH.UTF-8, it_IT.UTF-8, ja_JP.UTF-8, kk_KZ.UTF-8, ko_KR.UTF-8, lt_LT.UTF-8, nl_BE.UTF-8, nl_NL.UTF-8, no_NO.UTF-8, pl_PL.UTF-8, pt_BR.UTF-8, pt_PT.UTF-8, ro_RO.UTF-8, ru_RU.UTF-8, sk_SK.UTF-8, sl_SI.UTF-8, sr_YU.UTF-8, sv_SE.UTF-8, tr_TR.UTF-8, uk_UA.UTF-8, zh_CN.UTF-8, zh_HK.UTF-8, zh_TW.UTF-8 [4418] Failed to execute script main

exit status 1

Compilation error: exit status 1

Yes, I tried to consult https://click.palletsprojects.com/unicode-support/. It did not help.

How to reproduce ?

Open any sketch. Click Verify.

Debug Log

No response

Screenshots

No response

ApolloDS commented 1 year ago

Also check the issue here: Unicode/Locale compilation error #1513

per1234 commented 1 year ago

I am not able to reproduce the fault with versions of this platform that use adafruit-nrfutil 0.5.3.post16, which was introduced at https://github.com/adafruit/Adafruit_nRF52_Arduino/commit/19ee2ba5f305bd69cb0257dd3b83d1eb5521c65b ("Adafruit nRF52" platform version 0.22.1 or newer if you are using Boards Manager).

I am able to reproduce the fault with versions that use adafruit-nrfutil 0.5.3.post12 before the update at https://github.com/adafruit/Adafruit_nRF52_Arduino/commit/19ee2ba5f305bd69cb0257dd3b83d1eb5521c65b ("Adafruit nRF52" platform 0.22.0 or older if you are using Boards Manager).

I'm wondering why my results don't match with this part of the issue report:

BSP version

1.3.0

(I can't reproduce the fault using "Adafruit nRF52" platform version 1.3.0)

@exipilis please post the verbose compilation output so I can see the exact command that produced the error:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Check the box next to "Show verbose output during: > ☐ compilation"
  3. Click the OK button.
  4. Select File > New Sketch from the Arduino IDE menus.
  5. Select Tools > Board > Adafruit nRF52 > Feather nRF52840 Sense from the Arduino IDE menus.
  6. Select Sketch > Verify/Compile from the Arduino IDE menus.
  7. Wait for the compilation to fail.
  8. You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the COPY ERROR MESSAGES button on that notification.
  9. Paste the error messages in a reply here. In order to ensure the text is not corrupted, please use code fencing.
Mona-Roza commented 11 months ago

Same here:

Traceback (most recent call last): File "main.py", line 317, in 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 lists some UTF-8 supporting locales that you can pick from. The following suitable locales were discovered: af_ZA.UTF-8, am_ET.UTF-8, be_BY.UTF-8, bg_BG.UTF-8, ca_ES.UTF-8, cs_CZ.UTF-8, da_DK.UTF-8, de_AT.UTF-8, de_CH.UTF-8, de_DE.UTF-8, el_GR.UTF-8, en_AU.UTF-8, en_CA.UTF-8, en_GB.UTF-8, en_IE.UTF-8, en_NZ.UTF-8, en_US.UTF-8, es_ES.UTF-8, et_EE.UTF-8, eu_ES.UTF-8, fi_FI.UTF-8, fr_BE.UTF-8, fr_CA.UTF-8, fr_CH.UTF-8, fr_FR.UTF-8, he_IL.UTF-8, hr_HR.UTF-8, hu_HU.UTF-8, hy_AM.UTF-8, is_IS.UTF-8, it_CH.UTF-8, it_IT.UTF-8, ja_JP.UTF-8, kk_KZ.UTF-8, ko_KR.UTF-8, lt_LT.UTF-8, nl_BE.UTF-8, nl_NL.UTF-8, no_NO.UTF-8, pl_PL.UTF-8, pt_BR.UTF-8, pt_PT.UTF-8, ro_RO.UTF-8, ru_RU.UTF-8, sk_SK.UTF-8, sl_SI.UTF-8, sr_YU.UTF-8, sv_SE.UTF-8, tr_TR.UTF-8, uk_UA.UTF-8, zh_CN.UTF-8, zh_HK.UTF-8, zh_TW.UTF-8 [5993] Failed to execute script main

exit status 1

Compilation error: exit status 1

mzks commented 10 months ago

I faced the same error for Xiao BLE nRF52840 with the following instruction https://wiki.seeedstudio.com/XIAO_BLE/. My environment is M1 Max MacBook Pro and OS version is 13.4.1. Arduino IDE version is 2.1.1.

Traceback (most recent call last): File "main.py", line 317, in 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 lists some UTF-8 supporting locales that you can pick from. The following suitable locales were discovered: af_ZA.UTF-8, am_ET.UTF-8, be_BY.UTF-8, bg_BG.UTF-8, ca_ES.UTF-8, cs_CZ.UTF-8, da_DK.UTF-8, de_AT.UTF-8, de_CH.UTF-8, de_DE.UTF-8, el_GR.UTF-8, en_AU.UTF-8, en_CA.UTF-8, en_GB.UTF-8, en_IE.UTF-8, en_NZ.UTF-8, en_US.UTF-8, es_ES.UTF-8, et_EE.UTF-8, eu_ES.UTF-8, fi_FI.UTF-8, fr_BE.UTF-8, fr_CA.UTF-8, fr_CH.UTF-8, fr_FR.UTF-8, he_IL.UTF-8, hr_HR.UTF-8, hu_HU.UTF-8, hy_AM.UTF-8, is_IS.UTF-8, it_CH.UTF-8, it_IT.UTF-8, ja_JP.UTF-8, kk_KZ.UTF-8, ko_KR.UTF-8, lt_LT.UTF-8, nl_BE.UTF-8, nl_NL.UTF-8, no_NO.UTF-8, pl_PL.UTF-8, pt_BR.UTF-8, pt_PT.UTF-8, ro_RO.UTF-8, ru_RU.UTF-8, sk_SK.UTF-8, sl_SI.UTF-8, sr_YU.UTF-8, sv_SE.UTF-8, tr_TR.UTF-8, uk_UA.UTF-8, zh_CN.UTF-8, zh_HK.UTF-8, zh_TW.UTF-8 [26979] Failed to execute script main

exit status 1

Compilation error: exit status 1

mzks commented 10 months ago

Arduino legacy (version 1.8.19) works well.

hathach commented 7 months ago

not reproducible with latest Arduino BSP Core: 1.5.0 and IDE 2.2.1. Please try to update both BSP and IDE to latest and give it a try again. Feel free to comment, re-open issue should it still exists with latest BSP & IDE.

ingmanuelalfonso commented 6 months ago

Hi, I am facing the same error with an Intel MacBook Pro using a Wisblock 4631 with a nordicnrf52. I am using latest Arduino IDE 2.2.1

finally-fancy commented 6 months ago

I have the same error with the latest IDE 2.2.1

I'm not sure which python version the IDE ais using. how to analyse this?. I have set the defalt local in my .zshrc and my normal python dev env is working well with the locale

Arduino 1.8.19 is working well....

LucScu commented 5 months ago

@finally-fancy try to add export LC_ALL=en_US.utf-8 export LANG=en_US.utf-8 to the root user .profile file in /var/root

jefflai0101 commented 5 months ago

I faced the same error for Xiao BLE nRF52840 with the following instruction https://wiki.seeedstudio.com/XIAO_BLE/. My environment is M1 Max MacBook Pro and OS version is 13.4.1. Arduino IDE version is 2.1.1.

Traceback (most recent call last): File "main.py", line 317, in 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 lists some UTF-8 supporting locales that you can pick from. The following suitable locales were discovered: af_ZA.UTF-8, am_ET.UTF-8, be_BY.UTF-8, bg_BG.UTF-8, ca_ES.UTF-8, cs_CZ.UTF-8, da_DK.UTF-8, de_AT.UTF-8, de_CH.UTF-8, de_DE.UTF-8, el_GR.UTF-8, en_AU.UTF-8, en_CA.UTF-8, en_GB.UTF-8, en_IE.UTF-8, en_NZ.UTF-8, en_US.UTF-8, es_ES.UTF-8, et_EE.UTF-8, eu_ES.UTF-8, fi_FI.UTF-8, fr_BE.UTF-8, fr_CA.UTF-8, fr_CH.UTF-8, fr_FR.UTF-8, he_IL.UTF-8, hr_HR.UTF-8, hu_HU.UTF-8, hy_AM.UTF-8, is_IS.UTF-8, it_CH.UTF-8, it_IT.UTF-8, ja_JP.UTF-8, kk_KZ.UTF-8, ko_KR.UTF-8, lt_LT.UTF-8, nl_BE.UTF-8, nl_NL.UTF-8, no_NO.UTF-8, pl_PL.UTF-8, pt_BR.UTF-8, pt_PT.UTF-8, ro_RO.UTF-8, ru_RU.UTF-8, sk_SK.UTF-8, sl_SI.UTF-8, sr_YU.UTF-8, sv_SE.UTF-8, tr_TR.UTF-8, uk_UA.UTF-8, zh_CN.UTF-8, zh_HK.UTF-8, zh_TW.UTF-8 [26979] Failed to execute script main

exit status 1

Compilation error: exit status 1

Hi, I am under similar environment and same chip.

My problem was caused by adafruit-nrfutil. I found a way to workaround for my side.

I installed the adafruit-nrfutil with pip, and copied the pip version to where the adafruit-nrfutil is causing problem:

pip install adafruit-nrfutil mv "original-path/adafruit-nrfutil" "original-path/adafruit-nrfutil_bak" cp "pip-version/adafruit-nrfutil" "original-path/"

I hope this helps.

oleander commented 5 months ago

Installing adafruit-nrfutil from elsewhere and overriding the one used by Arduino IDE worked for me.

# pip3 install --user adafruit-nrfutil
find ~/Library/Arduino15/packages/adafruit/hardware/nrf52/* -name adafruit-nrfutil -exec ln -sf $(which adafruit-nrfutil) {} \;
Steppschuh commented 1 month ago

Installing adafruit-nrfutil from elsewhere and overriding the one used by Arduino IDE worked for me

Same, but: Using the latest version from pip3 install --user adafruit-nrfutil or any version from the official GitHub releases didn't work for me, however an old version that gets shipped with the Seeed nRF52 mbed-enabled Boards version 2.9.2 (accessible through the board manager in the Arduino LED) did the trick.

Attaching it here since it seems to be tricky to get the right version: adafruit-nrfutil.zip