Hi!
I am programming in esp-idf environment …
Why does such a line in the code lead to a compilation crash ??
#include <string.h>
.....
char * istr = strtok (tmp, sep);
out:
Building in release mode
Compiling .pio\build\esp-wrover-kit\src\interface.o
main\interface.c: In function 'checkCommand':
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Users\Alexander\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\Alexander\AppData\Local\Programs\Python\Python37\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "c:\users\alexander\.platformio\penv\lib\site-packages\platformio\proc.py", line 46, in run
self.do_reading()
File "c:\users\alexander\.platformio\penv\lib\site-packages\platformio\proc.py", line 69, in do_reading
for byte in iter(lambda: self._pipe_reader.read(1), ""):
File "c:\users\alexander\.platformio\penv\lib\site-packages\platformio\proc.py", line 69, in <lambda>
for byte in iter(lambda: self._pipe_reader.read(1), ""):
File "C:\Users\Alexander\AppData\Local\Programs\Python\Python37\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 251: character maps to <undefined>
Your compiler does not know about char * strtok (char * str, const char * sep);?
It is sad …
Seems more like decoding the compile error message has caused some defect with weird characters from a different charset (cyrillic?). Can you provide the exact interface.c
which causes the error?
1 Like
Could you try this branch ?
opened 08:09AM - 12 Mar 20 UTC
closed 01:17PM - 12 Nov 21 UTC
bug
known issue
build system
The cause of the issue: https://bugs.python.org/issue37993
## Solution 1
1… . [Open Windows Registry `regedit.exe`](https://support.microsoft.com/en-us/windows/how-to-open-registry-editor-in-windows-10-deab38e6-91d6-e0aa-4b7c-8878d9e07b11)
2. Create a new key named `Command Processor` at `HKEY_CURRENT_USER\Software\Microsoft`

3. Create a new `DWORD (32-bit) Value` named `DisableUNCCheck`

4. Set the value of `DisableUNCCheck` to `1` (Hex)

5. Restart your Windows machine.
## Solution 2
1. Download [our portable Python 3.7](https://dl.registry.platformio.org/download/platformio/tool/python-portable/1.30707.0/python-portable-windows_amd64-1.30707.0.tar.gz)
2. Extract and replace contents in `%HOMEPATH%/.platformio/python3`.
3. Remove `%HOMEPATH%/.platformio/penv` folder.
4. Restart VSCode.
-------------------
### Configuration
**Operating system**:
Windows_NT x64 10.0.17763
**PlatformIO Version** (`platformio --version`):
4.2.2b1
and
4.2.1
**Python Version**
3.8 32bit
### Description of problem
During compilation I get the Python Traceback UnicodeDecodeError: 'charmap' codec can't decode byte.
Full Message:
```
> Executing task in folder IR_Sender_WB: C:\Users\***\.platformio\penv\Scripts\platformio.exe run <
Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 2.3.3 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif8266 3.20603.200130 (2.6.3)
- tool-esptool 1.413.0 (4.13)
- tool-esptoolpy 1.20800.0 (2.8.0)
- toolchain-xtensa 2.40802.191122 (4.8.2)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 31 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <IRremoteESP8266> 2.7.4
Building in release mode
Compiling .pio\build\nodemcuv2\src\main.cpp.o
Generating LD script .pio\build\nodemcuv2\ld\local.eagle.app.v6.common.ld
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Users\***\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\***\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "c:\users\***\.platformio\penv\lib\site-packages\platformio\proc.py", line 46, in run
self.do_reading()
File "c:\users\***\.platformio\penv\lib\site-packages\platformio\proc.py", line 69, in do_reading
for byte in iter(lambda: self._pipe_reader.read(1), ""):
File "c:\users\***\.platformio\penv\lib\site-packages\platformio\proc.py", line 69, in <lambda>
for byte in iter(lambda: self._pipe_reader.read(1), ""):
File "C:\Users\***\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 167: character maps to <undefined>
Compiling .pio\build\nodemcuv2\lib70a\IRremoteESP8266\IRac.cpp.o
Compiling .pio\build\nodemcuv2\lib70a\IRremoteESP8266\IRrecv.cpp.o
Compiling .pio\build\nodemcuv2\lib70a\IRremoteESP8266\IRsend.cpp.o
Compiling .pio\build\nodemcuv2\lib70a\IRremoteESP8266\IRtext.cpp.o
Compiling .pio\build\nodemcuv2\lib70a\IRremoteESP8266\IRtimer.cpp.o
Compiling .pio\build\nodemcuv2\lib70a\IRremoteESP8266\IRutils.cpp.o
======================================================================================== [FAILED] Took 5.42 seconds ========================================================================================
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
```
### If problems with PlatformIO Build System:
**The content of `platformio.ini`:**
```ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
monitor_speed = 115200
```
### Additional info
On another PC with Python version 3.7 there are no problems compiling.
Here are the data of the PC where there is no problem:
Version: 1.43.0 (user setup)
Commit: 78a4c91400152c0f27ba4d363eb56d2835f9903a
Date: 2020-03-09T19:47:57.235Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.17763
PlatformIO: Core 4.2.1, Home 3.1.1
Thank you.
No free time to check.