BrickPi Scratch crashed on every load of Scratch file


I start the BrickPi service. It starts ok. Start Scratch. Enable the remote sensors in Scratch. Open a sample file and the service crashes on recv. I can restart the service and can run Scratch to control the BrickPi ok.


Hey JimW. A couple of quick questions:
Are you using the BrickPi image distro, or did you make the modifications to another image distro?
For me to try to troubleshoot this, I need to somehow recreate the problem.
Which example are you using that’s crashing?
What is connected to the BrickPi (which sensors)?
When you say “crashes on recv”, does this mean the service is crashing?
And when you say you can “restart the service and can run Scratch to control the BrickPi ok” does this mean the program runs normally afterwards?


I am using the Dexter image.

I’ve tried only the touch, ultrasonic, and motor scratch samples, all crash the service on load.

I’ve had the motors and sensors attached per each sample.

Yes, is what crashes each time. Since you can’t re-create it, I’ll get details tonight.

After crashes, I can restart it and run the Scratch sample ok. (With error messages, but then I see others get those too)


Here’s the output from It starts ok and says connected, then the other lines appear after opening the Car scratch file.

Connected to Scratch successfully
Traceback (most recent call last):
File “”, line 117, in <module>
m = s.receive()
File “/usr/local/lib/python2.7/dist-packages/scratchpy-0.1.0-py2.7.egg/scratch/”, line 256, in receive
return self._parse(self._recv())
File “/usr/local/lib/python2.7/dist-packages/scratchpy-0.1.0-py2.7.egg/scratch/”, line 196, in _recv
prefix = self._read(self.prefix_len)
File “/usr/local/lib/python2.7/dist-packages/scratchpy-0.1.0-py2.7.egg/scratch/”, line 188, in _read
raise ScratchConnectionError(“Connection broken”)
scratch.scratch.ScratchConnectionError: Connection broken


Hey JimW,

I’m sorry, I didn’t follow. What do you mean by starting the BrickPi service?

Just to double-check:
The correct procedure for connecting with scratch is:
First, enable the remote sensor connections in scratch.
Then, execute

If done the other way, that might be the reason for crash.

#6 is the service I’m talking about. See my post from 9/30 with the output and steps I follow.


If I open the Scratch file first, does not error out.

However, I see BrickPiRx Error: -2 and -5 often from, and when running Python sample code.


I am seeing the same problem with the BrickPiRx errors.
What do they mean?


JimW and fa001,

-2 - Means the BrickPi didn’t respond in time and the RPi is going to move on and try again later.
-5 - Means that the data moving between the RPi and the BrickPi didn’t calculate out properly.

Both of these are really debug options. They’re not critical failures though. I’m going to remove the debug option in Scratch; I don’t think users are going to pay much attention to that.