Flask in rosnode can't be terminated by control + C
I try to run flask code in ros like this. Every thing seems good until I try to terminate it by press Contrl + C. But it didn't work... Is there anyone know what's the problem or anyway I can terminate it?
if __name__ == '__main__':
rospy.init_node('client')
parser = ROSArgparse(relative='client/')
args = parser.parse_args()
client = InteractionClient(args)
app = Flask(__name__)
@App.route('/get_image/<int:idx>')
def image(idx):
###The view function for sending images with id
arr = load_image(idx)
img = Image.fromarray((arr*255).astype('uint8'))
# create file-object in memory
file_object = io.BytesIO()
# write PNG in file-object
img.save(file_object, 'PNG')
# move to beginning of file so `send_file()` it will read from start
file_object.seek(0)
return send_file(file_object, mimetype='image/PNG')
app.run(debug=True)
This is a flask problem not a ROS problem