模块mtrpacket没有属性MtrPacket

时间:2019-04-13 04:21:52

标签: python-3.x

这是我在ubuntu机器上尝试的程序:

from operator import itemgetter

max(h, key=itemgetter('high'))

当我尝试运行时,它发出如下错误:

import asyncio
import mtrpacket

async def trace():
    async with mtrpacket.ProbeResult() as mtr:
        for ttl in range(1, 256):
            result = await mtr.probe('google.com', ttl=ttl)
            print(result)

            if result.success:
                break

asyncio.get_event_loop().run_until_complete(trace())

请让我知道如何解决此问题

我也尝试过:

avproxy@ubuntu:~$ sudo python3 mtrpacket.py
Traceback (most recent call last):
  File "mtrpacket.py", line 2, in <module>
    import mtrpacket
  File "/home/avproxy/mtrpacket.py", line 13, in <module>
    asyncio.get_event_loop().run_until_complete(trace())
  File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in 
run_until_complete
    return future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/home/avproxy/mtrpacket.py", line 5, in trace
    async with mtrpacket.MtrPacket() as mtr:
AttributeError: module 'mtrpacket' has no attribute 'MtrPacket'

0 个答案:

没有答案