Reputation: 366
Having problem in bootstrapping my OBD scanner using python-obd library. I'm more of a Ruby guy, new to python. Doing the python-obd's tutorial code and terminal answers this:
File "car.py", line 2, in <module>
import obd
File "/Users/aabulkhairov/Development/publicobd/obd.py", line 3, in <module>
AttributeError: 'module' object has no attribute 'OBD'
Do i have to find the obd.py file and copy it to this file's folder?
Here's the car.py:
import obd
connection = obd.OBD() # auto-connects to USB or RF port
cmd = obd.commands.SPEED # select an OBD command (sensor)
response = connection.query(cmd) # send the command, and parse the response
print(response.value) # returns unit-bearing values thanks to Pint
print(response.value.to("mph")) # user-friendly unit conversions
Upvotes: 2
Views: 1584
Reputation: 314
One thing I learned is that you shouldn't name your (test) Python file:
obd.py
And then start with a search of the available ports:
ports = obd.scan_serial() # return list of valid USB or RF ports
Upvotes: 4