Unrecognized method, property, or field for generated protobuf message
Show older comments
Hi all,
We have a project where we communicate with a device using gRPC. On the computer, we run Python in a virtual enviornment. We load that environment in matlab using pyenv. We use MATLAB 2023b (23.2.0.2599560 (R2023b) Update 8) and Python 3.10.11.
Connecting with the device and querying some device information works in both, Python and MATLAB. However, since 2-3 months, we are unable to access members of protobuf messages. Below is an example of the code we execute in Python and the equivalent code executed in MATLAB:
Python:
% C:\work\data\kingfisher-py\.venv\Scripts\python.exe "..."
import kingfisher_py.lib as kgfLib
scn = kgfLib.device.Scanner('10.10.1.1', '8081')
device_info = scn.device_info.get_info()
device_info.sw_rev
items {
key: "mcu"
value: "v1.0.1"
}
items {
key: "kingfisher"
value: "5.2.0-cam-cal-third-party-rc.1-5-gd6f7161"
}
% response continues...
MATLAB:
>> kgfLib = py.importlib.import_module('kingfisher_py.lib');
>> scn = kgfLib.device.Scanner('10.10.1.1', '8081');
>> deviceInfo = scn.device_info.get_info();
>> deviceInfo.HasField('sw_rev')
ans =
logical
1
>> deviceInfo.sw_rev
Unrecognized method, property, or field 'sw_rev' for class 'py.kf.api.messages.system_pb2.GetDeviceInfoResponse'.
>> deviceInfo
deviceInfo =
Python GetDeviceInfoResponse with properties:
DESCRIPTOR: [1×1 py.google._upb._message.Descriptor]
manufact_rev {
device_name: "BLK360-2060047"
serial_number: "2060047"
}
sw_rev {
items {
key: "mcu"
value: "v1.0.1"
}
items {
key: "kingfisher"
value: "5.2.0-cam-cal-third-party-rc.1-5-gd6f7161"
}
% response continues...
Note that the same virtual environment is active. MATLAB even says that the field sw_rev exists, but still cannot access it. Also, we checked different versions and combinations of MATLAB and Python. Specifically:
- Matlab 9.10.0.2198249 (R2021a) Update 8 + Python 3.8.10
- Matlab 9.13.0.2193358 (R2022b) Update 5 + Python 3.8.10
- Matlab 9.13.0.2193358 (R2022b) Update 5 + Python 3.10.11
- Matlab 23.2.0.2599560 (R2023b) Update 8 + Python 3.10.11
The behaviour is the same with all versions. As the whole communication with the device is set up using protobuf, there is not much we can do with the device at this point as we run into this problem all accorss our MATLAB code base.
Is this a known issue, e.g. with a newer protobuf version? As mentioned, we did not have any issues like this until 2-3 months ago.
Hope to get some help or at least an explanation. Thank you :-)
1 Comment
Joel Buesser
on 12 Aug 2024
Edited: Joel Buesser
on 12 Aug 2024
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!