Open haydonryan opened 2 months ago
The problem here is that you're using the docs for the as-yet-unreleased 0.23 version, but the 0.22.2 version for your code.
Reopened because the README should be clearer about this.
hello, I have also experienced this issue and fixed the example based on suggestions from rust-analyser
it seems like there's been _bound added to some of the functions that are called in the readme
I have put the version that worked on my demo project into this pull request https://github.com/PyO3/pyo3/pull/4551
I am a novice with rust and like the concept of the library.
I was able to run the sample from the latest tag and everything ran great - thank you! This is a problem I've seen before, and feel like there's a few options you could look to improve the issue.
Add notes to both the sample applications (rust from python, python from rust). I would put this as the first step:
[!IMPORTANT]
Active development is done in the main branch. Breaking changes will and have occurred. Before attempting these instructions go to the latest tagged release. here. Do not use the branches named release-vxxxx.
(I ran into that problem)
Develop in a develop branch, and leave main as the latest stable release. (Then you have the problem of protecting pushes to main)
Another option would be to have people clone the repo and check out the latest tag as step one, but as dependencies aren't needed from GitHub probably wouldn't be a great option.
Thanks again for all your work here!
Bug Description
Sample fails to compile for calling python in rust
Brand new to trying to run python in a rust app haven't found one sample that compiles yet.
Steps to Reproduce
[dependencies]
[dependencies.pyo3] version = "0.22.2" features = ["auto-initialize"]
$ cat src/main.rs use pyo3::ffi::c_str; use pyo3::prelude::*; use pyo3::types::IntoPyDict;
fn main() -> PyResult<()> { Python::with_gil(|py| { let sys = py.import("sys")?; let version: String = sys.getattr("version")?.extract()?;
}
Your operating system and version
Kernel: Linux 6.10.9-arch1-1
Your Python version (
python --version
)Python 3.12.5
Your Rust version (
rustc --version
)rustc 1.81.0 (eeb90cda1 2024-09-04)
Your PyO3 version
0.22.2
How did you install python? Did you use a virtualenv?
system provided (via pacman). Yes created a venv using
python -m venv .
Additional Info
No response