nvs.bin error
when I used the " python provision.py --port COM3 --ssid "*****" --password "****" --target-ip 192.168.101.6 --target-port 5005", the error is Error generating NVS binary: 'str' object has no attribute 'size'
Fallback: save CSV and flash manually with ESP-IDF tools. Saved NVS CSV to nvs_config.csv Flash with: python $IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate nvs_config.csv nvs.bin 0x6000
I download and ran the ESP-IDF Powershell and did this command "python -m esptool --chip esp32s3 --port COM4 --baud 115200 write-flash 0x9000 nvs.bin" And you should see "Created NVS binary"
think you. I used " python D:/esp/v5.5.3/esp-idf/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate nvs_config.csv nvs.bin 0x6000" to create the binary. After that, I used your command, and I have successfully solved it.
Fix Available
The 'str' object has no attribute 'size' error occurs when using an older or incompatible version of esp_idf_nvs_partition_gen. This was addressed in the provisioning script — it now tries multiple import paths:
esp_idf_nvs_partition_gen.nvs_partition_gen(pip package)nvs_partition_gen(legacy import)- ESP-IDF bundled
nvs_partition_gen.pyscript - Module fallback
To fix, install the correct package:
pip install esp-idf-nvs-partition-gen
Or if using ESP-IDF's Python environment:
$IDF_PATH/tools/idf_tools.py install-python-env
The latest firmware v0.4.2-esp32 also adds --channel and --filter-mac options to provision.py. See release notes for full provisioning examples.
If you're still having issues, the script saves a fallback CSV (nvs_config.csv) that you can flash manually:
python $IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate nvs_config.csv nvs.bin 0x6000
python -m esptool --chip esp32s3 --port COM3 write_flash 0x9000 nvs.bin
Closing — the provisioning script handles multiple NVS generator backends. See comment above for install instructions. Reopen if you still hit issues with v0.4.2-esp32.
@ruvnet hmm, it actually doesn't do what you think it does. Once it fails on the package part it goes right away to CSV fallback. Tested with provision.py script from master.
attempt 1
Error generating NVS binary: 'str' object has no attribute 'size'
Fallback: save CSV and flash manually with ESP-IDF tools.
Saved NVS CSV to nvs_config.csv
I added attempt 1,2,3 prints in the code to see which logic gets triggered. Well, only attempt 1 prints.
Reason: You only handle "ImportError", so when any other error is thrown (like here this str and size error) it just won't handle it gracefully.
When we replace ImportError with generic Exception:
attempt 1
attempt 1 failed: 'str' object has no attribute 'size'
attempt 2
attempt 2 failed: No module named 'nvs_partition_gen'
It works. Also, it's rarely good idea to just "pass" without printing the error and indicating where it originated.