matt-kimball / mtr-packet-python

Asynchronous network probes for Python
Other
48 stars 6 forks source link

/bin/sh: mtr-packet: command not found #2

Closed kaon1 closed 1 year ago

kaon1 commented 3 years ago

Hi,

I'm unable to ping.py example. I tried editing my PATH to include the install directory but its still not working.

mtr-packet-python]# python3 ping.py google.com /bin/sh: mtr-packet: command not found Traceback (most recent call last): File "ping.py", line 37, in loop.run_until_complete(probe_coroutine) File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete return future.result() File "ping.py", line 13, in probe async with mtrpacket.MtrPacket() as mtr: File "/home/mtr-packet-python/mtrpacket/init.py", line 138, in aenter await self.open() File "/home/mtr-packet-python/mtrpacket/init.py", line 313, in open if not await self.check_support('send-probe'): File "/home/mtr-packet-python/mtrpacket/init.py", line 367, in checksupport (, args) = await self._command('check-support', check_args) File "/home/mtr-packet-python/mtrpacket/init.py", line 275, in _command return await future mtrpacket.ProcessError: failure to communicate with subprocess "mtr-packet" (is it installed and in the PATH?)

Some system info:

[root@net-tools03 mtr-packet-python]# pip3 list | grep mtrpacket mtrpacket 1.0.0 [root@net-tools03 mtr-packet-python]# echo $PATH /home/mtr-packet-python/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin [root@net-tools03 mtr-packet-python]# ls -ltrh total 28K -rw-r--r-- 1 root root 1.1K Jun 17 09:21 LICENSE -rw-r--r-- 1 root root 12K Jun 17 09:21 README.md drwxr-xr-x 2 root root 75 Jun 17 09:21 examples -rwxr-xr-x 1 root root 56 Jun 17 09:21 test.sh drwxr-xr-x 2 root root 39 Jun 17 09:21 test -rw-r--r-- 1 root root 695 Jun 17 09:21 setup.py drwxr-xr-x 2 root root 90 Jun 17 09:22 mtrpacket.egg-info drwxr-xr-x 4 root root 43 Jun 17 09:22 build drwxr-xr-x 2 root root 39 Jun 17 09:22 dist -rwxr-xr-x 1 root root 1.1K Jun 17 09:51 ping.py drwxr-xr-x 3 root root 44 Jun 17 09:51 mtrpacket

kaon1 commented 3 years ago

I think I figured it out, for future on-lookers:

I was using the "mtr" application from "yum install mtr". But I removed this and did a manual install of mtr from here https://github.com/traviscross/mtr

wget https://www.bitwizard.nl/mtr/files/mtr-0.94.tar.gz tar -xvzf mtr-0.94.tar.gz cd mtr-0.94 ./configure && make export MTR_PACKET=/home/mtr-0.94/mtr-packet

Now it seems to be working:

[root@net-tools03 mtr-packet-python]# python3 examples/ping.py google.com reply from 142.250.80.78 in 1.767 ms