Wireshark-dev: Re: [Wireshark-dev] Script extcap on macOS

From: Dario Lombardo <lomato@xxxxxxxxx>
Date: Thu, 18 Apr 2019 12:18:22 +0200


On Fri, Apr 12, 2019 at 10:32 PM Guy Harris <guy@xxxxxxxxxxxx> wrote:
On Apr 12, 2019, at 1:22 PM, Roland Knall <rknall@xxxxxxxxx> wrote:

> There seems to be an issue on mac, depending how the original Wireshark binary has been called. It seems to be, that by clicking on the icon, the system python interpreter get's loaded, which most certainly will let your script fail.

The script begins with

        #!/usr/bin/env python3

so the only way it should be run by the system Python interpreter - which is not a Python 3 interpreter:

        $ python --version
        Python 2.7.10

would be if it were run by "python {script path}" rather than just trying to run {script path} as an executable image.  (Or if somebody make a "python3" link to "/usr/bin/python", but that would be a very silly thing to do.)

Now, if you *did* install a Python 3 interpreter, but the directory in which it's installed isn't in $PATH - or if it's not installed as python3 - then the attempt to run the script won't work.


The travis builder shows

Python has been installed as
/usr/local/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin
If you need Homebrew's Python 2.7 run
brew install python@2
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.7/site-packages

 

What I understand is that python3 is installed and python2.7 is not. Then I guess it's a matter of paths. I expected "/usr/bin/env python3" to get the correct python interpreter. Am I wrong? If so, how can I make it find the right path? Creating a simlink could work and, since the machine gets destroyed after the build, I would not left a dirty system behind me. But I'd like to pursue a less hammered solution.