-
I'm using pyo3 0.23.4 as a library in my project and the compilation is failing in pyo3 because Borrowed has no method I have done a cargo clean and fresh build as well. I'm not sure how library compilation can fail. What other information can I share? error[E0599]: no method named `into_py_any` found for struct `instance::Borrowed<'_, '_, T>` in the current scope
--> /home/twitu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.23.4/src/instance.rs:829:17
|
652 | pub struct Borrowed<'a, 'py, T>(NonNull<ffi::PyObject>, PhantomData<&'a Py<T>>, Python<'py>);
| ------------------------------- method `into_py_any` not found for this struct
...
829 | (*self).into_py_any(py)
| ^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
help: there is a method `into_any` with a similar name, but with different arguments
--> /home/twitu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.23.4/src/instance.rs:32:5
|
32 | fn into_any(self) -> Self::Any;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: trait `IntoPyObjectExt` which provides `into_py_any` is implemented but not in scope; perhaps you want to import it
|
1 + use crate::conversion::IntoPyObjectExt;
| |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Most probable cause without seeing more code: In Rust, imports are not automatically in submodules, even if they are in the same file. You probably have a |
Beta Was this translation helpful? Give feedback.
I figured it out somehow while doing a search replace in vscode it changed the library logic as well. It's very weird because library files are generally not included in the search and replace.
Unfortunately even cargo clean and build did not reset the modified pyo3 logic in the cargo registry. But when I copied over the original instance.rs back to it then it started working. Pardon the silly issue.