[Zeek] Broker & Python 3

Jon Siwek jsiwek at corelight.com
Wed Jul 17 14:31:12 PDT 2019


On Wed, Jul 17, 2019 at 1:54 PM Neslog <neslog at gmail.com> wrote:
>
> I just compiled Broker and getting errors with python3x.  Here's the output.
>
> # python3 -c 'import broker; print(broker.__file__)'
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> ModuleNotFoundError: No module named 'broker'

That error is saying Python can't locate the broker module, so the
general thing you need to do is figure out why it can't locate it.

First thing to check would be if the Python bindings are being built
at all.  Does the summary of ./configure say "Python bindings: yes" ?

If they're built, then it also depends on whether you're installing it
or trying to run from the build directory ? If you're installing it,
are you doing it as part of a Bro/Zeek install or separately on its
own ?

If you're not installing, then you need to tell Python where to locate
it within the build directory:

$ PYTHONPATH=./build/python python3 -c 'import broker; print(broker.__file__)'
/Users/jon

If you're installing as part of Bro/Zeek, it's likely not installed at
a path where Python will locate it by default:

$ PYTHONPATH=/usr/local/zeek/lib/zeekctl python3 -c 'import broker;
print(broker.__file__)'
/usr/local/zeek/lib/zeekctl/broker/__init__.py

If you're installing Broker by itself, then it may choose a standard
place where it will be located by Python by default (e.g.
site-packages), but really depends on your system and how Broker is
configured, so might help to get more details from the output of your
./configure

- Jon


More information about the Zeek mailing list