just wondering if i can just copy and paste the library in python2 and use in python3 as i want to code in python3. Will i face any problems?
I think we updated BrickPi_Python to work with Python3 a few months ago. It should work fine. The examples may need some adjustments.
I’m curious. What do you have in mind when you say “copy/paste the library”?
When I want to code in Python3, I do the following:
cd ~/Desktop/GoPiGo/Software/Python sudo python3 setup.py install
That installs the library for Python3
Or you can bring the library into the same folder as your code. That should work too.
from what i read, when i install the gopigo library, it is installed in the python2 library. So i assume that i cannot control the robot using python3 because import will fail. So what is the simplest way to use python3 to control the robot?
As Cleo mentioned above, the easiest way to install the GoPiGo library systemwide is to fo the the GoPiGo python folder and install it using :
cd ~/Desktop/GoPiGo/Software/Python sudo python3 setup install
This would let all your python3 programs access the GoPiGo library.
I managed to get into the the required directory but when I tried:
sudo python3 setup install then i get this:
python3: can’t open file ‘setup’: [Errno 2] No such file or directory
What should i do?
Sorry, my fault.
you have to put the extension at the end of the file
So once in the required directory, you need to type in:
sudo python3 setup.py install
ETA: I’ve edited the above post for future readers.
thanks. it works now
I now have a problem running the library when i tried to load the library into the SD card that came with my RPi, (not from Dex Ind). I followed the instructions here:
then i get this error message about smbus not found. Managed to solve this reinstalling smbus. Then this error came up which i have no idea how to overcome.
File “build/bdist.linux-armv6l/egg/gopigo.py”, line 49, in <module> IOError: [Errno 2] No such file or directory
I further tried with python3 and this came up.
File “<frozen importlib._bootstrap>”, line 2237, in _find_and_load
File “<frozen importlib._bootstrap>”, line 2226, in _find_and_load_unlocked
File “<frozen importlib._bootstrap>”, line 1191, in _load_unlocked
File “<frozen importlib._bootstrap>”, line 1161, in _load_backward_compatible
File “usr/local/lib/python3.4/dist-packages/GoPiGo-0.0.0-py3.4.egg/gopigo.py”, line 49, in <module>
FileNotFoundError: [Errno 2] No such file or directory
update: Not sure why but i follow the instructions on this page and changed the last step to sudo ./install.sh and now it works
Great to hear that you’re all set!