Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miniterm error in make monitor #954

Closed
eliabieri opened this issue Sep 3, 2017 · 7 comments
Closed

miniterm error in make monitor #954

eliabieri opened this issue Sep 3, 2017 · 7 comments

Comments

@eliabieri
Copy link
Contributor

when I want to use make monitor I get the following error.
I use Mac OS 10.12.5 and pyserial is up to date.

Traceback (most recent call last):
File "/Users/eliabieri/Documents/ESP-IDF/esp-idf/tools/idf_monitor.py", line 568, in
main()
File "/Users/eliabieri/Documents/ESP-IDF/esp-idf/tools/idf_monitor.py", line 502, in main
monitor.main_loop()
File "/Users/eliabieri/Documents/ESP-IDF/esp-idf/tools/idf_monitor.py", line 269, in main_loop
self.handle_serial_input(data)
File "/Users/eliabieri/Documents/ESP-IDF/esp-idf/tools/idf_monitor.py", line 300, in handle_serial_input
self.console.write_bytes(b)
File "/usr/local/lib/python3.6/site-packages/serial/tools/miniterm.py", line 63, in write_bytes
self.byte_output.write(byte_string)
TypeError: a bytes-like object is required, not 'int'
make: *** [monitor] Error 1

@eliabieri
Copy link
Contributor Author

I found the solution.

When you are using Python 2.x str is a byte array. For Python 3, you must use bytes like this:

struct.unpack("<h", bytes([b, a]))[0]

@projectgus
Copy link
Contributor

Thanks for updating, @eliabieri . Even though esptool.py works with both Python 2 & 3,, for now we only support Python 2.x in IDF (and associated tools like idf_monitor).

If you need to configure IDF to run "python2" instead of "python", you can do this in menuconfig under "SDK Tools".

@hanfengcan
Copy link

i use py3,but error like this

@neilpanchal
Copy link

@projectgus What are the plans to upgrade and support Python 3? I hope we make progress because Python 3 is now the default in Ubuntu and frankly, it is the way forward.

@projectgus
Copy link
Contributor

@neilpanchal There is a PR #1284 that adds most of the changes for Python 3 support in idf_monitor, although it seems to have stalled.

We don't have an ETA for Python 3 support, otherwise, although I agree it would be great to support in IDF.

@lausellduane
Copy link

@eliabieri I got the same error. How do I implement this "For Python 3, you must use bytes like this:
struct.unpack("<h", bytes([b, a]))[0]" in order to solve the problem?

@Herschdorfer
Copy link

I made a PR but its pointless since there is already work ongoig.

chnaging the build command from:
python ${IDF_PATH}/tools/windows/eclipse_make.py -j24

to

python2 ${IDF_PATH}/tools/windows/eclipse_make.py -j24

solved the issue for me.

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

No branches or pull requests

6 participants