ImportError:无法导入名称UDPListeners

2024-05-16 02:01:49 发布

您现在位置:Python中文网/ 问答频道 /正文

代码:

#!/usr/bin/python
#coding: utf-8

from brisa.core.reactors.qtreactor import QtReactor
reactor = QtReactor()

from brisa.core.network_listeners import UDPListeners

def forward_data(data, addr=""):
    """ This is the data handler function, in this example it will simply        
        print the received data and the address from where it came
    """
    print data, "from ", addr
server = UDPListener(   "239.255.255.250",
                        port,
                        "interface",
                        data_callback = foward_data
                    )

""" Be sure to register the UDPListener’s stop function before using the

    start method, or the program doesn’t end.
"""
server.start()
reactor.add_after_stop_func(server.stop)
reactor.main()

错误:

^{pr2}$

Tags: thefromcoreimportdataserveritfunction