Start using odrive with python


Hey guys, I just get started with odrive.

When I run the simplest program to test, it shows AttributeError: module ‘odrive’ has no attribute ‘find_any’ Does anyone know how to fix it?

I’m using Anaconda3 in Windows 8.1. I’ve already installed the odrive library ( pip install odrive ), and there is no problem with connection since I can see it is connected in odrivetool.


Your file that you’re running is also called I think it’s trying to import itself, and finds that it doesn’t have a find_any() method in it. Rename your file to anything else (maybe ‘’) and you’ll be fine.


Thanks Josh! So stupid I am:joy:

It stops warning. But the new thing is nothing will happen after running this script. It should print something I guess but there it not. Could you please help me further with it?

Thanks again.


I would recommend playing around interactively to get a feel for what functionality is available. In PyCharm, open up a Python console, which should launch iPython (or just the python REPL if you don’t have iPython installed in your environment). Then try things like:

import odrive

od = odrive.find_any()
axis = od.axis0
mo = axis.motor
enc = axis.encoder

If you execute these lines one at a time in the python console, you’ll see the output from each one. The ODrive, Axis, Motor and Encoder objects all print out some nice information to the console.


Hi Josh, thank you for helping me out!

Your method works. It looks cool!

I am also curious how do you usually work with odrive? Always execute the commands line by line, but not write all things you want to do in a single script and run it at one time?


If I’m just trying to get something working, I tend to explore by running it interactively. Once I get an idea of how to accomplish a smaller part of the larger task, I’ll put that into a script and keep going from there.

Also note that when you are running a script in PyCharm, there is an option in the Run configuration dialog to ‘Run with Python console,’ which will leave the REPL (the interactive interpreter) still running after the script has finished, allowing you continue interacting with it.