From sphero_sdk import SpheroRvrObserver

I am on an desktop mac running 10.15.1 Catalina
using ssh to do most of the work on the raspberry pi
I can’t get any of the sample programs to run without errors.
My troubleshooting: trying to get as simple as possible …

If I just go into python
then enter

from sphero_sdk import SpheroRvrObserver

I get the error "ModuleNotFoundError: No module named ‘sphero_sdk’ "

Is there something I have to add in the sys.path?

As you can probably tell, I am very new to the Sphero RVR SDK.

Have you read through the following thread? It definitely helped me to get a RPi communicating properly with the RVR. Once you can successfully run the example Python scripts, you should be in decent shape.

and this tutorial from Sphero is helpful, but I still needed the tweaks from the above thread.

1 Like

I found one of the examples had the path statement with …/…/…/ had 1 too many …/ which resulted in Python looking in wrong directory layer resulting in the sdk not found. After correcting the issue it worked fine. The drive with keyboard had the correct path structure in the statement, but the led demo had incorrect one.

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(file), ‘…/…/’)))

1 Like

Hey @Terracode!

Could you give us a few more details on where you found the incorrect path statement, so that we can fix it?

Are you working out of the RP Python Repo as a whole, or did you create your own structure with only select files?

Any direction would be deeply appreciated; thank you for finding this!

Most Kindly,
Kelsey

1 Like

Repo was created following the getting started with Python instructions on the sdk site. The repo was created in the home directory.

1 Like

GOT IT WORKING

Raspberry pi 4
added pip3 install aiohttp
added pip3 install pyserial_asyncio

if not connected to the RVR, got “Checking RVR firmware version” … and a several errors

pipenv shell
cd ~/sphero-sdk-raspberrypi-python/getting_started/asyncio/led
python set_single_led.py
When connected,
Checking RVR firmware versions…
Checking CMS firmware versions…
Firmware check complete.

Feeling good.
When I put the SD card in my raspberry pi 3, it does NOT work!
" could not open port /dev/ttyS0: [Errno 2] No such file or directory: ‘/dev/ttyS0’"

@brightnbubbly
The sys.path.append statements in the examples on your Python How-To appear to have one too many …/ and didn’t work unless the extra was removed to look like the examples in the SDK projects directory for Python. The code example that has this issue is LEDs - Set All LEDs with Helper. Seems like all the examples on the page are using the same extra …/ .

1 Like

Thank you so much for clarifying. I did play with the examples in our How Tos to see if that was where the issue was, but not with that one, specifically, so I will go back to try that one :slight_smile:

The examples on the How To page are three levels down from the root, where as the Samples, like “Drive with Keyboard” are only two levels down from the root, so the discrepancy makes sense on that front, but I would really like to get to the bottom of why the structure was giving you issues so that it doesn’t happen again…

Thank you so so much for explaining further and super happy that you did find a way to use the scripts successfully!!

Kelsey