def convertToDisplay(self, byte_string_package): packet_rcv = Package() packet_rcv.setData(byte_string_package) if packet_rcv.OPTIONS[2] == 2 or packet_rcv.OPTIONS[2] == 5: self.client.package.CIADDR = packet_rcv.YADDR self.uiManager.viewButton.setHidden(False) # save in the file the latest ip address numeric_ip = [] if packet_rcv.OPTIONS[2] == 5: numeric_ip = [int(byte) for byte in packet_rcv.YADDR] with open("IP_History", 'w') as file: ip_addr = f"{numeric_ip[0]}.{numeric_ip[1]}.{numeric_ip[2]}.{numeric_ip[3]}" file.write(ip_addr) print(f"Packet manager:\n{packet_rcv}")