Solved!Error for project "Build a Self Driving Car With the GoPiGo3"

facing a error

pi@dex:~/Desktop/chetuk $ sudo python
Traceback (most recent call last):
File “”, line 5, in
my_Distance_portI2C = easy.DistanceSensor(‘I2C’, gpg, use_mutex=True)
NameError: name ‘gpg’ is not defined
pi@dex:~/Desktop/chetuk $

1 Like

hello @chetuk,

the gpg variable is never instantiated. Try adding
gpg = easy.EasyGoPiGo3()
on line 4

added the variable new error
im using raspbian OS any solution
using the code

Traceback (most recent call last):
  File "", line 5, in <module>
    my_Distance_portI2C = easy.DistanceSensor('I2C', gpg, use_mutex=True)
  File "build/bdist.linux-armv7l/egg/", line 1194, in DistanceSensor
  File "build/bdist.linux-armv7l/egg/", line 1096, in old_instantiation
ValueError: Invalid use of mutex: the GoPiGo3 does not use mutex protection and the distance sensor does.
pi@dex:~/Desktop/chetuk $

Change this to
my_Distance_portI2C = easy.DistanceSensor('I2C', gpg)

We’ll make the changes to the website too. Thank you for reporting those!

@cleoqc not sure but the website seems not update with the changes.
please help to fix the code on website appreciate as working project!

It will take a couple of days before we can get the changes on the website.
In the meantime, can you use these files: (1.6 KB) (1.4 KB)

Thanks for the script but not working as expected .
Doesnt seems the sensor are working with the above code.

/Chetan S.

What errors or behaviours are you getting?



@cleoqc the attached script worked thanks!! :grinning:

My mistake

I update the OS (sudo apt-get update & upgrade)
So again re imaged raspbian OS
Switched connection on the I2C port for the line & distance sensors



Yeah! Great you figured it out!
Stuff like that is hard to debug from a distance, so thank you!

1 Like