You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ZMQ write() fails with NumPy values — file path converts types but ZMQ path doesn’t #246
In concore.py , file‑based write() converts NumPy values to native Python types (convert_numpy_to_python()), but the ZMQ path sends the raw val directly into send_json_with_retry(). If val contains numpy.float64, numpy.int64, or arrays, JSON serialization fails and the message is never sent (you just get an “Unexpected error during ZMQ write” log).
This makes mixed studies or ZMQ‑only studies brittle whenever NumPy is involved (which is almost always in control loops).
Where
concore.py, write() function, ZMQ branch.
Steps to reproduce
Create a ZMQ‑based study or a simple script.
Call concore.write("port_name", "data", [np.float64(1.0), np.int64(2)]).
Observe the error log and missing message.
Expected
ZMQ writes should accept NumPy values the same way file‑based writes do.
Actual
ZMQ send_json fails to serialize NumPy types and the message is dropped.
Suggested fix
Apply convert_numpy_to_python() before send_json_with_retry() in the ZMQ path. This keeps ZMQ and file behavior consistent.
If this sounds reasonable, I’m happy to open a PR with a small regression test as well.
Thanks, @pradeeban Sir, I’ve opened the PR #256 It fixes ZMQ JSON serialization for NumPy types, adds a regression test, and keeps existing behavior intact. Full test suite passes (python -m pytest -v, 55 tests). I’d be grateful for your review and any feedback.
Activity
pradeeban commentedon Feb 11, 2026
@Titas-Ghosh sure, go ahead.
Titas-Ghosh commentedon Feb 11, 2026
Thanks, @pradeeban Sir, I’ve opened the PR #256 It fixes ZMQ JSON serialization for NumPy types, adds a regression test, and keeps existing behavior intact. Full test suite passes (
python -m pytest -v, 55 tests). I’d be grateful for your review and any feedback.