hello everybody i am working with pox as my controller for mininet topology. in my pox cod in the def _handle_PacketIn, i call function for send port_stats_request, 2 times within 5 minutes. also i writhed def _handle_portstats_received(event) , for handle portsatsrecieved event, so that , i call this function as core.openflow.addListenerByName("PortStatsReceived", _handle_portstats_received) in the def launch (). in the def _handle_portstats_received(event) , i open a text file (with open('Portstats.txt', 'a') as f) and i save info to it, then i want use the this text file( with open('Portstats.txt', 'r') as f) in the def _handle_PacketIn,But I am faced with a problem. when i run this command (with open('Portstats.txt', 'r') as f) i have one error: This directory does not exist. after this error, def _handle_portstats_received(event) create portstats.txt, now my question is , how i can write a bet before this command(with open('Portstats.txt', 'r') as f) , that, when this text created , then run this command?
def _handle_PacketIn(event): send request for port stats 2 time within 5 minc *?????? i want to write a bet here* with open('Portstats.txt', 'r') as f: # do somthing def _handle_portstats_received(event): with open('Portstats.txt', 'a') as f: # do somthing def launch (): core.openflow.addListenerByName("PortStatsReceived", _handle_portstats_received) please help me for solve this problem, thanks