[Solved] Error Running the basic_robot.py example

That’s right John, hoping to see some magic.

Well, I’m afraid there is not magic, only engineering.

Maybe we should double check you’re using Raspbian for robots. Can you please go to the Desktop and take a picture if you’re using VNC, or in the command line, type

cd ~/Desktop 
ls -l

And take a screenshot of the results?

Thanks!

Please find attached screenshot

Hey @rajat-ray this hasn’t had Raspbian for Robots installed on it. It looks like you have a basic install of Raspbian on it. Please see the links above for installing Raspbian for Robots!

here are the steps that I have done after assembling the gopigo. My gopigo
and raspberrypi are assembled together.

  1. Connected the Raspberrypi with Ethernet cable to my Windows laptop

  2. sudo apt-get update

3. sudo apt-get upgrade

4. git clone https://github.com/DexterInd/GoPiGo.git
https://github.com/DexterInd/GoPiGo.git

5. A folder named GoPiGo should appear in you current working directory.

6. Open it and go to Setup Files directory:

  • cd Setup*

7. The install script is called install.sh . Make it executable

sudo chmod +x install.sh

8. Run the script and follow the instructions

./install.sh

9. sudo reboot

10. Open Putty with raspberrypi.local

Username:pi

Pwd:raspberry

cd /home/pi/GoPiGo/Software /Python/

sudo python setup.py install
11. cd ~/GoPiGo/Software/Python/Examples/Basic_Robot_Control

pi@raspberrypi:~/GoPiGo/Software/Python/Examples/Basic_Robot_Control $ sudo
python basic_robot.pyTraceback (most recent call last): File
"basic_robot.py", line 39, in <module> from gopigo import * #Has the
basic functions for controlling the GoPiGo Robot File
"build/bdist.linux-armv7l/egg/gopigo.py", line 49, in
<module>IOError: [Errno 2] No such file or directory

And then I get above error.

Regards

Rajat

Was this just copied from this older post? The mis-spellings are exactly the same!

Again, to move forward, I think your best option is to Install Rapsbian for Robots. See how to do it here.

If you really need to continue to use a different operating system, please run these commands:

cd /home/pi/GoPiGo/Software /Python/
sudo python setup.py install

And post a screenshot of the results.

On the existing system I ran below commands and please find attached
screenshot:
cd /home/pi/GoPiGo/Software /Python/ sudo python setup.py install

@rajat-ray: Can you run the install script again as sudo and paste the output here

sudo ./install.sh

From the error, it looks like one of the packages didn;t install correctly. If you still face the same problem, can you post a screenshot of the error too

Here you go the entire log

gopigolog.txt (11.5 KB)

Doesn’t appear to be anything in the txt file.

Did you run the install scripts? Do you have a screenshot for Karan?

Yes. I ran and entire log is in txt file. I can very well open the log
file.

I also tried opening the log and it is empty. Can you try uploading it again along with the screenshots .

Thanks for having the patience to test this out. I also wanted to ask if there is specific reason why you are not using our Raspbian for Robots image.

here is the log I am pasting in this mail:

pi@raspberrypi:~/GoPiGo/Setup pi@raspberrypi:~/GoPiGo/Setup sudo ./install.sh


| __ \ | |
| | | | _____ | | ___ _ __
| | | |/ _ \ / / / _ \ '|
| || | /> <| || / |
|
/ _
//___|| _ _
|
| | | | | ()
| | _ __ | | _ | | _ __ _ ___ ___
| | | ’
\ / \ | | | / __| | '| |/ _ / __|
| || | | | (
| | |
| _
\ || | | | /_
|
___|
| ||_,|_,|/_|| ||_||/


| ____ | | |] | | ____ | |
|
| || | | || |_____|
Welcome to GoPiGo Installer.
Please ensure internet connectivity before running this script.
NOTE: Raspberry Pi wil reboot after completion.Special thanks to Joe
Sanford at Tufts University. This script was derived from his work. Thank
you Joe! Must be running as Root user
Press ENTER to begin…
Check for internet connectivity…
Connected
Installing Dependencies
Reading package lists… Done
Building dependency tree
Reading state information… Done
arduino is already the newest version.
git is already the newest version.
libnss-mdns is already the newest version.
minicom is already the newest version.
python-dev is already the newest version.
python-pip is already the newest version.
python-serial is already the newest version.
i2c-tools is already the newest version.
libi2c-dev is already the newest version.
python-rpi.gpio is already the newest version.
python-smbus is already the newest version.
The following packages were automatically installed and are no longer
required:
libasn1-8-heimdal libftdi1 libgssapi3-heimdal libhcrypto4-heimdal
libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal
libkrb5-26-heimdal libroken18-heimdal libwind0-heimdal libxfce4ui-1-0
xfce-keyboard-shortcuts
Use ‘apt-get autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
Requirement already up-to-date: RPi.GPIO in /usr/lib/python2.7/dist-packages
Cleaning up…
Dependencies installed
running install
running bdist_egg
running egg_info
writing GoPiGo.egg-info/PKG-INFO
writing top-level names to GoPiGo.egg-info/top_level.txt
writing dependency_links to GoPiGo.egg-info/dependency_links.txt
reading manifest file 'GoPiGo.egg-info/SOURCES.txt’
writing manifest file ‘GoPiGo.egg-info/SOURCES.txt’
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build/bdist.linux-armv7l/egg
copying build/lib.linux-armv7l-2.7/gopigo.py -> build/bdist.linux-armv7l/egg
byte-compiling build/bdist.linux-armv7l/egg/gopigo.py to gopigo.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying GoPiGo.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying GoPiGo.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying GoPiGo.egg-info/dependency_links.txt ->
build/bdist.linux-armv7l/egg/EGG-INFO
copying GoPiGo.egg-info/top_level.txt ->
build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents…
creating ‘dist/GoPiGo-0.0.0-py2.7.egg’ and adding
’build/bdist.linux-armv7l/egg’ to it
removing ‘build/bdist.linux-armv7l/egg’ (and everything under it)
Processing GoPiGo-0.0.0-py2.7.egg
Removing /usr/local/lib/python2.7/dist-packages/GoPiGo-0.0.0-py2.7.egg
Copying GoPiGo-0.0.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages
GoPiGo 0.0.0 is already the active version in easy-install.pth
Installed /usr/local/lib/python2.7/dist-packages/GoPiGo-0.0.0-py2.7.egg
Processing dependencies for GoPiGo==0.0.0
Finished processing dependencies for GoPiGo==0.0.0
running install
running bdist_egg
running egg_info
writing Adafruit_DHT.egg-info/PKG-INFO
writing top-level names to Adafruit_DHT.egg-info/top_level.txt
writing dependency_links to Adafruit_DHT.egg-info/dependency_links.txt
reading manifest file 'Adafruit_DHT.egg-info/SOURCES.txt’
writing manifest file ‘Adafruit_DHT.egg-info/SOURCES.txt’
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
running build_ext
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/Adafruit_DHT
copying build/lib.linux-armv7l-2.7/Adafruit_DHT/Test.py ->
build/bdist.linux-armv7l/egg/Adafruit_DHT
copying build/lib.linux-armv7l-2.7/Adafruit_DHT/common.py ->
build/bdist.linux-armv7l/egg/Adafruit_DHT
copying build/lib.linux-armv7l-2.7/Adafruit_DHT/init.py ->
build/bdist.linux-armv7l/egg/Adafruit_DHT
copying build/lib.linux-armv7l-2.7/Adafruit_DHT/Raspberry_Pi.py ->
build/bdist.linux-armv7l/egg/Adafruit_DHT
copying build/lib.linux-armv7l-2.7/Adafruit_DHT/Raspberry_Pi_2.py ->
build/bdist.linux-armv7l/egg/Adafruit_DHT
copying build/lib.linux-armv7l-2.7/Adafruit_DHT/Beaglebone_Black.py ->
build/bdist.linux-armv7l/egg/Adafruit_DHT
copying build/lib.linux-armv7l-2.7/Adafruit_DHT/Raspberry_Pi_2_Driver.so ->
build/bdist.linux-armv7l/egg/Adafruit_DHT
copying build/lib.linux-armv7l-2.7/Adafruit_DHT/platform_detect.py ->
build/bdist.linux-armv7l/egg/Adafruit_DHT
byte-compiling build/bdist.linux-armv7l/egg/Adafruit_DHT/Test.py to Test.pyc
File “build/bdist.linux-armv7l/egg/Adafruit_DHT/Test.py”, line 22
import .Test_Driver as driver
^
SyntaxError: invalid syntax
byte-compiling build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py to
common.pyc
byte-compiling build/bdist.linux-armv7l/egg/Adafruit_DHT/init.py to
init.pyc
byte-compiling build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi.py to
Raspberry_Pi.pyc
byte-compiling build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2.py
to Raspberry_Pi_2.pyc
byte-compiling
build/bdist.linux-armv7l/egg/Adafruit_DHT/Beaglebone_Black.py to
Beaglebone_Black.pyc
byte-compiling build/bdist.linux-armv7l/egg/Adafruit_DHT/platform_detect.py
to platform_detect.pyc
creating stub loader for Adafruit_DHT/Raspberry_Pi_2_Driver.so
byte-compiling
build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2_Driver.py to
Raspberry_Pi_2_Driver.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_DHT.egg-info/PKG-INFO ->
build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_DHT.egg-info/SOURCES.txt ->
build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_DHT.egg-info/dependency_links.txt ->
build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_DHT.egg-info/top_level.txt ->
build/bdist.linux-armv7l/egg/EGG-INFO
writing build/bdist.linux-armv7l/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents…
creating ‘dist/Adafruit_DHT-1.2.0-py2.7-linux-armv7l.egg’ and adding
’build/bdist.linux-armv7l/egg’ to it
removing ‘build/bdist.linux-armv7l/egg’ (and everything under it)
Processing Adafruit_DHT-1.2.0-py2.7-linux-armv7l.egg
Removing
/usr/local/lib/python2.7/dist-packages/Adafruit_DHT-1.2.0-py2.7-linux-armv7l.egg
Copying Adafruit_DHT-1.2.0-py2.7-linux-armv7l.egg to
/usr/local/lib/python2.7/dist-packages
Adafruit-DHT 1.2.0 is already the active version in easy-install.pth
Installed
/usr/local/lib/python2.7/dist-packages/Adafruit_DHT-1.2.0-py2.7-linux-armv7l.egg
Processing dependencies for Adafruit-DHT==1.2.0
Finished processing dependencies for Adafruit-DHT==1.2.0
fatal: destination path ‘wiringPi’ already exists and is not an empty
directory.
wiringPi Build script

WiringPi Library
[UnInstall]
make: Nothing to be done for ‘all’.
[Install Headers]
[Install Dynamic Lib]
WiringPi Devices Library
[UnInstall]
make: Nothing to be done for ‘all’.
[Install Headers]
[Install Dynamic Lib]
GPIO Utility
make: Nothing to be done for ‘all’.
[Install]
All Done.
NOTE: To compile programs with wiringPi, you need to add:
-lwiringPi
to your compile line(s) To use the Gertboard, MaxDetect, etc.
code (the devLib), you need to also add:
-lwiringPiDev
to your compile line(s).
wiringPi Installed
Removing blacklist from /etc/modprobe.d/raspi-blacklist.conf . . .
I2C removed from blacklist
SPI removed from blacklist
Adding I2C-dev and SPI-dev in /etc/modules . . .
I2C-dev already there
i2c-bcm2708 added
spi-dev added
Making I2C changes in /boot/config.txt . . .
Making changes to Arduino . . .
–2016-08-31 12:48:59–
http://project-downloads.drogon.net/gertboard/avrdude_5.10-4_armhf.deb
Resolving project-downloads.drogon.net (project-downloads.drogon.net)…
188.246.205.22, 2a03:9800:10:7b::2
Connecting to project-downloads.drogon.net
(project-downloads.drogon.net)|188.246.205.22|:80…
connected.
HTTP request sent, awaiting response… 200 OK
Length: 202814 (198K) [application/x-debian-package]
Saving to: ‘avrdude_5.10-4_armhf.deb’
avrdude_5.10-4_armhf.deb
100%[==========================================================================================================================================>]
198.06K --.-KB/s in 0.001s
2016-08-31 12:49:01 (143 MB/s) - ‘avrdude_5.10-4_armhf.deb’ saved
[202814/202814]
(Reading database … 123678 files and directories currently installed.)
Preparing to unpack avrdude_5.10-4_armhf.deb …
Unpacking avrdude (1:5.10-4) over (1:5.10-4) …
Setting up avrdude (1:5.10-4) …
Processing triggers for man-db (2.7.0.2-5) …
–2016-08-31 12:49:17–
http://project-downloads.drogon.net/gertboard/setup.sh
Resolving project-downloads.drogon.net (project-downloads.drogon.net)…
188.246.205.22, 2a03:9800:10:7b::2
Connecting to project-downloads.drogon.net
(project-downloads.drogon.net)|188.246.205.22|:80…
connected.
HTTP request sent, awaiting response… 200 OK
Length: 1870 (1.8K) [application/x-sh]
Saving to: ‘setup.sh
setup.sh
100%[==========================================================================================================================================>]
1.83K --.-KB/s in 0s
2016-08-31 12:49:18 (76.1 MB/s) - ‘setup.sh’ saved [1870/1870]
Setting up Raspberry Pi to make it work with the Gertboard
and the ATmega chip on-board with the Arduino IDE.
Checking …
Avrdude: OK
Arduino IDE: OK
Fetching files:
boards.txt
programmers.txt
avrsetup
Replacing/updating files:
inittab: cp: cannot stat ‘inittab’: No such file or directory
./setup.sh: line 61: inittab: No such file or directory
mv: cannot stat ‘/tmp/inittab.6115’: No such file or directory
OK
cmdline.txt: Backup exists: not overwriting
boards.txt: Backup of boards.txt exists, not overwriting
programmers.txt: Backup of programmers.txt exists, not overwriting
All Done.
Check and reboot now to apply changes.
no crontab for root
rm: cannot remove ‘/tmp/di_update’: No such file or directory
The user pi' is already a member ofi2c’.
chmod: cannot access
‘/home/pi/Desktop/GoPiGo/Software/Scratch/GoPiGo_Scratch_Scripts/*.sh’: No
such file or directory
Please restart the Raspberry Pi for the changes to take effect
Please restart to implement changes!


| __ | |/ | |/\ | __ _ |
| |
) | |
| (
| | / \ | |) | | |
| _ /| | _ \ | | / /\ \ | _ / | |
| | \ | |
__ ___) | | |/ ____ | | \ \ | |
|
| __
|__/ |// __| _\ |_|
Please restart to implement changes!
To Restart type sudo reboot
pi@raspberrypi:~/GoPiGo/Setup $

Thanks for pasting the log in. It’s a surefire method and now we can see it properly. Those forums are brand new, maybe there’s an issue in their configuration. Sorry about that, we’ll look into that specific issue (of not seeing the log file)

As for the log itself, it seems perfectly fine. There are couple of error messages in it, but those errors do not matter.
Could you run a test for me if you don’t mind?
Open up a terminal window
Type python and return
On the very first line, there will be a version number for python. Could you confirm that it’s a version that starts with 2, and not 3? (most likely it will be 2.7.9)
You’ll have a new prompt that will look like this: >>>
type in import gopigo and return
Are you getting an error message then?

Thanks for your patience on this as we work through the issue.

Cleo

Python version is 2.7.9 also, after I type in import gopigo and return, I
don’t get any error message.

Can you try out this example: https://github.com/DexterInd/GoPiGo/blob/master/Software/Python/basic_test_all.py and give the f command first and see if it works.

Can you also run i2cdetect -y 1 in the terminal and paste what you get.

I finally made it to work, but now another problem till my gopigo and
raspberry pi is connected to usb cable, it works and accepts the commands
for movement.
As soon as I disconnect the usb cable and connect the battery power, it
doesn’t work and my putty session also gets disconnected.

Any help?

What was causing the problems and what made them go away.

Coming to the power issue, are your batteries fresh and have voltage greater than 9V. It might have restarted, can you turn of the GoPiGo and power it from the batteries and see if you are able to connect via putty in a minute or so and are you using Ethernet or wifi to connect.

it works now, your line “connect via putty in a minute or” worked…

thanks for the time.

Great to hear that.

I am still wondering what your initial error was from. Do you have any more pointers on what might be causing it and what ended up solving it. It would really help us to improve our documentation.

Thanks a lot for your patience with the problem and sorry for the initial hiccups. I hope you have a great experience with the GoPiGo.