[toolchain v2.0] How to flash binary? (ImportError: No module named serial)

DrSegatron
Posts: 22
Joined: Tue Oct 10, 2017 2:46 pm

[toolchain v2.0] How to flash binary? (ImportError: No module named serial)

Postby DrSegatron » Mon Jul 29, 2019 4:02 am

I can flash the newly built binary with idf.py flash no problem, but how do I flash a supplied binary?

I get this tip after building from source:
Project build complete. To flash, run this command:
..\..\..\..\..\esp-idf\components\esptool_py\esptool\esptool.py -p com26 -b 921600 --after hard_reset write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build\bootloader\bootloader.bin 0x8000 build\partition_table\partition-table.bin 0x1d000 build\ota_data_initial.bin 0x20000 build\project.bin
or run 'idf.py -p com26 flash'
But when run:
Pyserial is not installed for C:\Python27\python.exe. Check the README for installation instructions.
Traceback (most recent call last):
File "C:\esp-idf\components\esptool_py\esptool\esptool.py", line 37, in <module>
import serial
ImportError: No module named serial
pyserial is already installed:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/developme ... -2-support
Requirement already satisfied: pyserial in c:\users\jebj\.espressif\python_env\idf4.0_py2.7_env\lib\site-packages (3.4)
Edit:

Using cmd shell.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: [toolchain v2.0] How to flash binary? (ImportError: No module named serial)

Postby ESP_igrr » Mon Jul 29, 2019 1:08 pm

If you are using a new cmd.exe window (not the one where you were using idf.py) then run path\to\idf\export.bat first. Then you can use esptool.

Or open the "ESP-IDF Command Prompt" shortcut in start menu, it is created by the installer.

DrSegatron
Posts: 22
Joined: Tue Oct 10, 2017 2:46 pm

Re: [toolchain v2.0] How to flash binary? (ImportError: No module named serial)

Postby DrSegatron » Mon Jul 29, 2019 1:15 pm

I am using the same window.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: [toolchain v2.0] How to flash binary? (ImportError: No module named serial)

Postby ESP_igrr » Mon Jul 29, 2019 8:58 pm

Ah, I see now. Can you please try adding 'python' in front of the pyserial command? I.e.

python ..\..\..\..\..\esp-idf\components\esptool_py\esptool\esptool.py -p com26 (rest of the command)

DrSegatron
Posts: 22
Joined: Tue Oct 10, 2017 2:46 pm

Re: [toolchain v2.0] How to flash binary? (ImportError: No module named serial)

Postby DrSegatron » Tue Jul 30, 2019 1:11 am

Yes that makes it work.

But I had to restart the shell to get the message to work again:
Project build complete. To flash, run this command:
Traceback (most recent call last):
File "C:\esp-idf\tools\idf.py", line 1311, in <module>
main()
File "C:\esp-idf\tools\idf.py", line 1226, in main
cli(prog_name=PROG)
File "C:\Users\jebj\.espressif\python_env\idf4.0_py2.7_env\lib\site-packages\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "C:\Users\jebj\.espressif\python_env\idf4.0_py2.7_env\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "C:\Users\jebj\.espressif\python_env\idf4.0_py2.7_env\lib\site-packages\click\core.py", line 1164, in invoke
return _process_result(rv)
File "C:\Users\jebj\.espressif\python_env\idf4.0_py2.7_env\lib\site-packages\click\core.py", line 1102, in _process_result
**ctx.params)
File "C:\Users\jebj\.espressif\python_env\idf4.0_py2.7_env\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "C:\esp-idf\tools\idf.py", line 885, in execute_tasks
self._print_closing_message(global_args, completed_tasks)
File "C:\esp-idf\tools\idf.py", line 799, in _print_closing_message
print_flashing_message("Project", "project")
File "C:\esp-idf\tools\idf.py", line 787, in print_flashing_message
cmd.strip(),
LookupError: unknown encoding: cp65001

Who is online

Users browsing this forum: doragasu, ferrero and 119 guests