Issues communicating via USB

Let me start off by saying that I am very much a beginner to all of this and have struggled my way through so far. I managed to get the firmware on the board and it boots up but when I open the demo.py or explore_odrive.py it says (opening in ILDE):
Traceback (most recent call last):
File “/Users/brandonlima/ODrive/tools/demo.py”, line 6, in
import odrive.core
File “/Users/brandonlima/ODrive/tools/odrive/core.py”, line 8, in
import usb.core
ModuleNotFoundError: No module named ‘usb’

And (open in python launcher):
Brandons-MBP-2:~ brandonlima$ cd ‘/Users/brandonlima/ODrive/tools/’ && ‘/usr/bin/pythonw’ ‘/Users/brandonlima/ODrive/tools/explore_odrive.py’ && echo Exit status: $? && exit 1
File “/Users/brandonlima/ODrive/tools/explore_odrive.py”, line 33
printer = print
^
SyntaxError: invalid syntax
Brandons-MBP-2:tools brandonlima$

Any ideas, suggestions?

Thanks for your patience.
Personally I have never launched python scripts from IDLE or python launcher. I always run my python scripts from the bash console. Maybe someone else here in the community can help you with your specific way of doing it. Or you can try to launch from the bash console as recommended in the instructions.

You will need to install pyusb. This can be done on the bash console with this command: pip install pyusb.

Edit: You should also make sure to run the python scripts with python3.

Thanks! I was only launching it via IDLE or python launcher since I couldn’t figure out how to lanch it in bash, sorry I am super new to everything and stumbling through this… I think my problem might be that pyusb is installed in the wrong python library.

Brandons-MBP-2:tools brandonlima$ pip install pyusb
Requirement already satisfied: pyusb in /Library/Python/2.7/site-packages
Brandons-MBP-2:tools brandonlima$

Now I will try and figure that out. Thanks for the super fast help!

No worries, we hare here to help. :slight_smile:
If you don’t need python 2 for anything, you can uninstall python 2, and then you are only left with python3. Then pip install will be able to target python3 by default.

If you don’t want to do it that way, then you have to start looking at how to get pip to target python3 even though your default python isn’t that. Maybe this is helpful?

Using:
“sudo pip3 install pyusb”

seemed to work

"Requirement already satisfied: pyusb in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Brandons-MBP-2:~ brandonlima$ "

Although it still doesn’t work, same error, I am thinking I am opening the .py file an incorrect way. Using “run” doesn’t work “-bash: run: command not found” open just opens it in the default problem, ideas?

try the command: python3 demo.py

unfortunately, these are the results…

Brandons-MBP-2:tools brandonlima$ python3 demo.py
Traceback (most recent call last):
File “demo.py”, line 6, in
import odrive.core
File “/Users/brandonlima/ODrive/tools/odrive/core.py”, line 10, in
import serial
ModuleNotFoundError: No module named ‘serial’

Yes, sorry we really should make it give you more constructive error messages. The other thing you need to install, just like pyusb, is pyserial.
So I guess this command will work for you: sudo pip3 install pyserial.

I did
“pip3 install pyusb pyserial”

and it works!!!

Thank you so much!

Okay great! Thanks for daring to try something you are unfamiliar with. Hopefully you can make something cool! ;D