Closed xiaguangbo closed 2 years ago
Hello @xiaguangbo,
thank you for the detailed report, this will help us a lot!
There are reports of this issue in the esptool repository: https://github.com/espressif/esptool/issues/740 EDIT: not the same thing
We will fix this ASAP.
@radimkarnis I assume it's the same thing. The reason this happens is that sys.executable
is in d:\software\esp\.espressif\python_env\idf5.0_py3.8_env\Scripts
while esptool.py
is in d:\software\esp\esp-idf\components\esptool_py\esptool
. It's definitely a case fixed by https://github.com/espressif/esptool/pull/742.
@dotlambda This issue seems to be a result of this wrapper script importing itself. This wrapper is a part of ESP-IDF and serves as a compatibility layer. You can see that in this one, we try to remove the path to the script itself:
sys.path.remove(os.path.dirname(os.path.realpath(__file__))) # do not import this script
https://github.com/espressif/esptool/pull/742 concerns a wrapper script, which is directly in the esptool repository. The issue is similar, but I don't think both of these can be solved in the same place.
@dotlambda I was getting the same "module 'esptool' has no attribute '_main'" error. Your fix worked for me! I am now able to communicate with my ESP8266!
@RavioliSauce, thanks for confirming this! Could you please verify if this also solves the issue?
@radimkarnis Today I reinstalled the whole environment and it works fine, I don't know if this is a code fix or something is wrong with my previous environment
@xiaguangbo thanks for the info and cooperation!
We have released esptool v4.0.1 with a fix. Hopefully, this definitely solves the issue.
I used ESP-IDF setup in Visual Studio Code insiders, and installed Master and tools using the interface, on a Windows10 PC, and got the same issue now. I cannot flash my code to ESP32-S3-DevKitC-1
Traceback (most recent call last): File "c:\esp\esp-idf-master\esp-idf\components\esptool_py\esptool\esptool.py", line 22, in
esptool._main() # type: ignore AttributeError: module 'esptool' has no attribute '_main'
@wreyford Delete the esptool_py
folder and use git pull
, delete ./espressif/python_env
and reinstall using the install
script, try
hola cuando intento flashear un esp32 me sale este error
Traceback (most recent call last):
File "C:\Users\Osniel\AppData\Local\Programs\Python\Python312\Scripts\esptool.py", line 37, in
como pudiera solucionar esto
porque me sale este error
Traceback (most recent call last):
File "C:\Users\Osniel\AppData\Local\Programs\Python\Python312\Scripts\esptool.py", line 37, in
si alguien pudiera ayudar
@radimkarnis I have the exact same problem! I don't know what to do
Environment
git describe --tags
to find it): v5.0-dev-2959-g31b7694551xtensa-esp32-elf-gcc --version
to find it): xtensa-esp32s2-elf-gcc.exe (crosstool-NG esp-2021r2-patch3) 8.4.0Problem Description
vscode 'Espressif IDF' plugin the 'ESP-IDF Flash device' button:
do it manually: can see that the 'esptool' module exists
I tried adding 'peintf('\n aaa \n')' to 'D:\software\esp.espressif\python_env\idf5.0_py3.8_env\Scripts\esptool.py' and 'D:\software\esp.espressif\python_env\idf5.0_py3.8_env\Lib\site-packages\esptool.py', but I don't see the output, but I can see two outputs when I add it to 'd:\software\esp\esp-idf\components\esptool_py\esptool\esptool.py', apparently 'd:\software\esp\esp-idf\components\esptool_py\esptool\esptool.py' is importing itself
If 'idf.py' is used, it is normal
I renamed 'esptool.py' to 'esptool2.py' and executed it manually, the result is correct: Although there is a 'No such file or directory: 'main.bin'' error in the middle, it is simply solved