Home        Store        Learn        Blog

Can't run simplePingExample.py

I am trying to run simplePingExample.py for " Ping Sonar Altimeter and Echosounder " on Linux PC but it doesn’t want to run and this error is appear:

Traceback (most recent call last):
File “simplePingExample.py”, line 4, in
from brping import Ping1D
File “/home/ahmed/.local/lib/python2.7/site-packages/brping/init.py”, line 4, in
from brping.device import PingDevice
File “/home/ahmed/.local/lib/python2.7/site-packages/brping/device.py”, line 38
def connect_serial(self, device_name: str, baudrate: int =115200):
SyntaxError: invalid syntax

I followed this instruction from github : https://github.com/bluerobotics/ping-python

the version of python and bluerobotics-ping library that I am using:
Python 2.7.17

Hi @MohamedAli,

Python 2 is deprecated, please run or install it with Python 3.

Hi @patrickelectric,

I have same problem.

I am working simplePingExample.py in raspberry pi 3, I also followed the recommands in git hub.

And I used python3.4.

But I have same problem. The error message is follwoing.

ImportError: No module named ‘brping.definitinos’

I also add the path.

Please let me know how to solve it.

Sanghee Cha at Korea

Hi Sanghee,

have you installed bluerobotics-ping with pip3 ?