Bridge error (crash)

I have a python script in rc.local that uses the Bridge. This works fine, but just this evening after plugging in my Arduino, I saw my script crashed (I put the script output to a file) with following exception:

  File "/mnt/sda1/arduino/Yafa/BridgeComm.py", line 45, in send
    bc.put('key_get',msg)
  File "/usr/lib/python2.7/bridge/bridgeclient.py", line 60, in put
    json = TCPJSONClient('127.0.0.1', 5700)
  File "/usr/lib/python2.7/bridge/tcp.py", line 65, in __init__
    TCPClient.__init__(self, address, port)
  File "/usr/lib/python2.7/bridge/tcp.py", line 38, in __init__
    client.connect((address, port))
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 146] Connection refused

I tried to regeneratle this by powering off/on my Yun, but I have not been able to get this error again. (now works ok)

Any idea what might be going on? The only thing I can suspect is that I ssh'd immediately to the Yun after its linux boot. Could this cause such an error?

Hi Newline,

you need a sketch in the AVR that uses the bridge library, than its works. The python scripts fails if no sketch with bridge is running. I had the same issue. I start my python script from sketch with the process command.

Regards
Andreas

Thanks for the answer.

I do have a sketch that used the Bridge. In fact, I only saw this behavior once. Without any changed to sketch or linux side, all the other times it worked fine.

It is interesting to see that you start the python script from the sketch, whilst I 'start the sketch' from the python script. I consider the python side as the master.

  • 'start the sketch' means for me: reset the MCU + send it an Init message over the Bridge. The first thing the sketch does is to wait for that Init message (and acknowledge this to the python side if it saw it)