Skip to content

Conversation

@mnishiguchi
Copy link

@mnishiguchi mnishiguchi commented Jan 9, 2026

Description

Fixes a :eacces error when running mix atomvm.esp32.flash in an environment where IDF_PATH is set.

Environment

  • OS: Linux (fish)
  • Elixir: 1.17.3 (Erlang/OTP 27)
  • ESP-IDF: 5.4 (IDF_PATH=/home/mnishiguchi/esp/esp-idf)
  • Python: ESP-IDF venv (python3, python)
  • ESP-IDF esptool.py is not executable:
$ ls -l $IDF_PATH/components/esptool_py/esptool/esptool.py
.rw-rw-r-- ... /home/mnishiguchi/esp/esp-idf/components/esptool_py/esptool/esptool.py

Error observed

Flashing using esptool..
** (ErlangError) Erlang error: :eacces
    :erlang.open_port(
      {:spawn_executable,
       ".../esp-idf/components/esptool_py/esptool/esptool.py"},
      [...]
    )

Cause

When IDF_PATH is set, ExAtomVM uses ESP-IDF’s bundled esptool.py. In some setups (including the ESP-IDF 5.4 environment above), this script is not executable, so attempting to execute it directly fails with :eacces.

Fix

When IDF_PATH is set, execute ESP-IDF’s esptool.py via python3/python instead of executing the script directly. The task now also fails fast with concise, actionable errors when esptool.py or python is missing.

Test

  • IDF_PATH unset → uses esptool.py from PATH
  • IDF_PATH set → runs python <esptool.py> ... without :eacces

Notes

  • Using the Pythonx-based flow avoids this, but since pythonx is optional, users on the system esptool path—especially with IDF_PATH set—can still hit :eacces. This PR hardens that path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant