Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: status_subscriber.get(timeout) causes TypeError #322

Open
awelzel opened this issue Mar 27, 2023 · 0 comments
Open

Python: status_subscriber.get(timeout) causes TypeError #322

awelzel opened this issue Mar 27, 2023 · 0 comments

Comments

@awelzel
Copy link
Contributor

awelzel commented Mar 27, 2023

Using .get() providing a timeout on a StatusSubscriber causes TypeError splash:

In [6]: ss = ep.make_status_subscriber(True)
In [7]: ss.get(0.5)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
TypeError: Unregistered type : std::optional<std::variant<broker::none, broker::error, broker::status> >

The above exception was the direct cause of the following exception:

TypeError                                 Traceback (most recent call last)
<ipython-input-7-4fcab5cf726a> in <module>
----> 1 ss.get(0.1)

/opt/zeek-dev-prod/lib/zeek/python/broker/__init__.py in get(self, *args, **kwargs)
    208 
    209     def get(self, *args, **kwargs):
--> 210         x = self._subscriber.get(*args, **kwargs)
    211         return self._to_result(x)
    212 

TypeError: Unable to convert function return value to a Python type! The signature was
        (self: broker._broker.StatusSubscriber, arg0: float) -> std::optional<std::variant<broker::none, broker::error, broker::status> >

Did you forget to `#include <pybind11/stl.h>`? Or <pybind11/complex.h>,
<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic
conversions are optional and require extra headers to be included
when compiling your pybind11 module.

This works fine with a normal subscriber with a 0.5 second delay:

In [13]: ss = ep.make_subscriber("/topic/test")

In [14]: r = ss.get(0.5)

In [15]: print(repr(r))
None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants