Closed hyousefGopher closed 4 years ago
Nope.
The just-published 0.5.1 version allows you to do this: https://github.com/fusion-engineering/inline-python/blob/9c1d04fee1f5fb71bde2356d91b3f2cea81134b2/examples/rust-fn.rs
I got the below for the code in the link:
D:\rust_webview>cargo run
Compiling rust_webview v0.1.0 (D:\rust_webview)
error[E0432]: unresolved import `pyo3`
--> src\main.rs:6:1
|
6 | #[pyfunction]
| ^^^^^^^^^^^^^ help: a similar path exists: `inline_python::pyo3`
|
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared type or module `pyo3`
--> src\main.rs:14:16
|
14 | c.add_wrapped(wrap_pyfunction!(rust_print));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type or module `pyo3`
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared type or module `pyo3`
--> src\main.rs:6:1
|
6 | #[pyfunction]
| ^^^^^^^^^^^^^ use of undeclared type or module `pyo3`
|
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
Make sure pyo3
is imported, (if your crate doesn't depend on pyo3
directly):
use inline_python::pyo3;
Thanks a lot, it is ok now, may you need to add it in the code, so no one else come with the same issue again :)
Can I do something like below, so that I create a Rust block inside the Python block !