Open yujia21 opened 5 months ago
The TaskManager is a singleton class that is created in run() if one hasn't already been created. The task manager is responsible for scheduling tasks like that timeout, and one hasn't been created yet.
The solution is to create one, e.g., from bacpypes.task import TaskManager; TaskManager()
, in your main()
before creating the IOCB and setting the timeout, or putting the code in some function like init_things_to_do()
and calling deferred(...)
to "schedule" the function call inside run()
, which will be after the task manager is created.
Why this weird dance? I wanted the ability for developers to create a subclass of TaskManager
with their own behavior and I use it for the tests, see the TimeMachine. This design is fine for what it is when it was written, but it also makes the library not thread safe.
Tasks and IOCBs all go away in BACpypes3 in favor of asyncio and you can do things like some_value = await app.read_property(...)
.
Much thanks. Wasn't aware that bacpypes3 existed, will definitely be checking it out.
Hello, I'm updating dependencies for an application that receives requests from clients and then sends it on to a bacnet server using bacpypes. The "send" in question looks like this:
Prior to the dependency update we were at v0.16.1 and didn't face any issues. On updating to v0.17 onwards, the first "send" always fails with
but subsequent sends work well.
I'm not familiar enough with bacpypes to know if it's linked to a change between the versions and what to change on our side, any ideas?