Nano ESP32 gen_esp32part.py:517: UnicodeWarning:

Hi there! I'm currently writing some code for an Arduino Nano ESP32 and when I hit verify on Arduino IDE 2.3.2 it shows the following message:
gen_esp32part.py:517: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
Sketch uses 293597 bytes (9%) of program storage space. Maximum is 3145728 bytes.
Global variables use 31108 bytes (9%) of dynamic memory, leaving 296572 bytes for local variables. Maximum is 327680 bytes.

As the first part of the message is in red I assume it's an error or, at least, a warning, and so it isn't compiling (I'm not sure because I don't yet have the board in my hands). I've searched around and found this Git issue (gen_esp32part.py 517:UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal · Issue #8611 · espressif/arduino-esp32 · GitHub) which has not been touched since it was posted in September of last year.

Thanks for any help in advance!

2 Likes

Yes they need to release an update. I have special characters in my pc name as well

Hi @joao_ff_duarte.

As the "Warning" in "UnicodeWarning" implies, it is a warning, not an error.

It did indeed compile. This part of the output is only printed after a successful compilation:

You should also see that Arduino IDE displays a "Done compiling." notification (it automatically closes after a few seconds, but in case you miss it you can click the icon that looks like a bell at the bottom right corner of the Arduino IDE window to see it). This notification is only shown if the compilation is successful.

So, unless you are experiencing an actual problem, please just ignore the warning.

In case you are interested, the warning is being generated by this line of code:

The gen_esp32part script has a command line interface with this format:

gen_esp32part <input> <output>

(where <input> and <output> are placeholders for arguments that specify the path of the input and output files)

So if Arduino IDE runs this command:

"C:\\Users\\ÖÖÖ\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.16\\tools\\gen_esp32part.exe" -q "C:\\Users\\ÖÖÖ\\AppData\\Local\\Temp\\arduino\\sketches\\EA779503578984CAE9E5AC2C28797FBC/partitions.csv" "C:\\Users\\ÖÖÖ\\AppData\\Local\\Temp\\arduino\\sketches\\EA779503578984CAE9E5AC2C28797FBC/sketch_may6a.ino.partitions.bin"

Then the value of args.output is "C:\\Users\\ÖÖÖ\\AppData\\Local\\Temp\\arduino\\sketches\\EA779503578984CAE9E5AC2C28797FBC/sketch_may6a.ino.partitions.bin" and thus the script's "interpreting them as being unequal" result when comparing that string to - is completely fine and everything is working exactly as intended.

The line in the gen_esp32part script that generates the warning is for a feature that allows you to set the <output> argument to - if you want the script to print the output instead of writing it to a file. Arduino IDE never uses that feature, so we don't need to worry about it at all. Even for those who use the script directly from the command line and do use the feature, there is also nothing to worry about because by its very nature there can never be a case where they will be passing a unicode character as this argument when intending to cause the script to print the output.


So all this is to say: forget about the warning and get back to having fun with Arduino!