#!/usr/bin/env python
import sys, rospy
from raspimouse_ros.msg import LightSensorValues

def talker():
    rospy.init_node('lightsensors')
    pub = rospy.Publisher('lightsensors', LightSensorValues, queue_size=10)
    rate = rospy.Rate(10)

    while not rospy.is_shutdown():
        with open('/dev/rtlightsensor0','r') as f:
            data = f.readline().split()
            d = LightSensorValues()
            d.right_forward = int(data[0])
            d.right_side = int(data[1])
            d.left_side = int(data[2])
            d.left_forward = int(data[3])
            pub.publish(d)
            rate.sleep()

if __name__ == '__main__':
    try:
        talker()

    except rospy.ROSInterruptException:
        pass

#!/usr/bin/env python
import sys, rospy
from raspimouse_ros.msg import LightSensorValues

def talker():
    rospy.init_node('lightsensors')
    pub = rospy.Publisher('lightsensors', LightSensorValues, queue_size=1)
    rate = rospy.Rate(10)

    while not rospy.is_shutdown():
        with open('/dev/rtlightsensor0','r') as f:
            data = f.readline().split()
            d = LightSensorValues()
            d.right_forward = int(data[0])
            d.right_side = int(data[1])
            d.left_side = int(data[2])
            d.left_forward = int(data[3])
            pub.publish(d)
            rate.sleep()

if __name__ == '__main__':
    try:
        talker()

    except rospy.ROSInterruptException:
        pass

Change the buffer size