Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9872 Discussions

i2C LCD crashing


I am trying to handle my python script crashing...Seeed grove LCD. Seems to run for a month or so. Some units crash more frequently.

Jan 27 02:20:42 edison libmraa[196]: i2c6: write_byte_data: Access error: Remote I/O error

Because I can't cause the error (even unplugging the LCD), I want to make sure that I can handle the exception.

First, I would like to handle it and let the rest of my code run:

while 1:





Rest of code....

0 Kudos
3 Replies
Community Manager

Hello Zaker,



Thanks for reaching out!



I tested your code and, as expected, it didn't fail. I'd probably have to wait a long time before being able to see the issue. I'm not sure how you could handle this error from Python, nevertheless, if the process is stopped I might have an idea of how to solve this problem.



You can use the script originally mentioned in 445830 445830 in order to monitor a running process and restart it whenever it stops. The code would look like this:



# !/bin/bash



check_process() {


echo "$ts: checking $1"


[ "$1" = "" ] && return 0


[ `pgrep -n $1` ] && return 1 || return 0





while [ 1 ]; do


# timestamp


ts=`date +%T`



echo "$ts: begin checking..."


check_process "python"


[ $? -eq 0 ] && echo "$ts: not running, restarting..." && `python`


sleep 5





***You'll need to install procps, procps-dbg, procps-dev and procps-doc in order to use pgrep, this packages can be downloaded from the official repo.



If this solution doesn't help you, I'd suggest you to contact the developers of mraa directly ( and report them the issue you are facing in order to see if they can provide you a more accurate response.



I hope this information helps you,


Pedro M.

Thanks for your reply!

Yes, the failure can be after a month or two of operation.

I will look into using your script to watch the other. It would take me time to implement that on all of my installs.

Do you not think the error would be caught by an exception in Python?

Community Manager

Since I'm not able to replicate the error I can't say for sure that Python is able to handle it. Since it is an error thrown by mraa, you might want to talk to them (with the link I posted above) to see if this is possible. Perhaps they can tell you if it is possible or even a hint on how to do it. The only useful thing I can share about this is Python's documentation about handling exceptions which mayhap you can find useful:



Pedro M.