luigisaetta / obdii

The repo contains the Python code developed for the Connected Car OSS work
http://lsaetta.blogspot.it/
MIT License
20 stars 4 forks source link

OBD2 code not working on Google Voice Kit #5

Closed luigisaetta closed 6 years ago

luigisaetta commented 6 years ago

Jan 5 08:07:01 raspberrypi runProd.sh[1372]: self.interface = ELM327(port, baudrate, protocol) Jan 5 08:07:01 raspberrypi runProd.sh[1372]: File "/home/pi/AIY-voice-kit-python/env/lib/python3.4/site-packages/obd/elm327.py", line 143, in init Jan 5 08:07:01 raspberrypi runProd.sh[1372]: self.send(b"ATZ", delay=1) # wait 1 second for ELM to initialize Jan 5 08:07:01 raspberrypi runProd.sh[1372]: File "/home/pi/AIY-voice-kit-python/env/lib/python3.4/site-packages/obd/elm327.py", line 408, in send Jan 5 08:07:01 raspberrypi runProd.sh[1372]: return self.read() Jan 5 08:07:01 raspberrypi runProd.sh[1372]: File "/home/pi/AIY-voice-kit-python/env/lib/python3.4/site-packages/obd/elm327.py", line 441, in read Jan 5 08:07:01 raspberrypi runProd.sh[1372]: data = self.port.read(self.port.in_waiting or 1) Jan 5 08:07:01 raspberrypi runProd.sh[1372]: AttributeError: 'Serial' object has no attribute 'in_waiting' Jan 5 08:07:02 raspberrypi systemd[1]: obd2.service: main process exited, code=exited, status=1/FAILURE Jan 5 08:07:02 raspberrypi systemd[1]: Unit obd2.service entered failed state.

luigisaetta commented 6 years ago

From StackOverflow:

0 down vote Per the documentation of pyserial v3.0, in_waiting "changed to property from inWaiting()". This leads me to believe that your pyserial library is too old for the odb library (ie. odb is using the pyserial library in a way that your version can't handle; it doesn't have the in_waiting property that odb is looking for, instead it has the older inWaiting() method instead). You can check your version of pyserial with: >>> import serial >>> serial.VERSION '2.6' If you're not at version 3.x, you will need to upgrade the pyserial library.

At the end, I upgraded to pyserial 3.x and the bug was solved.

Solution: upgrade your pyserial library to version 3.x.

luigisaetta commented 6 years ago

Solution: upgrade library pyserial.