Skip to content

Commit

Permalink
The error I'm trying to solve can be reproduced by
Browse files Browse the repository at this point in the history
running `python/fastsim/demos/demo_hev.py` and then
```python
import msgpack
fsim.SimDrive.from_msg_pack(msgpack.packb(msgpack.loads(sd.to_msg_pack())))
```
which yields:
```

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[8], line 1
----> 1 fsim.SimDrive.from_msg_pack(msgpack.packb(msgpack.loads(sd.to_msg_pack())))

OSError: invalid type: string "\"[]\"", expected a sequence
```
  • Loading branch information
calbaker committed Jan 4, 2025
1 parent 2bccd07 commit 697a7b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fastsim-core/fastsim-proc-macros/src/fastsim_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ fn add_serde_methods(py_impl_block: &mut TokenStream2) {
#[staticmethod]
#[pyo3(name = "from_msg_pack")]
#[pyo3(signature = (msg_pack, skip_init=None))]
pub fn from_msg_pack_py(msg_pack: &Bound<PyBytes>, skip_init: Option<bool>) -> PyResult<Self> {
pub fn from_msg_pack_py(msg_pack: &[u8], skip_init: Option<bool>) -> PyResult<Self> {
Self::from_msg_pack(
msg_pack.as_bytes(),
msg_pack,
skip_init.unwrap_or_default()
).map_err(|e| PyIOError::new_err(format!("{:?}", e)))
}
Expand Down

0 comments on commit 697a7b4

Please sign in to comment.