Skip to content

Commit 493f08e

Browse files
committed
ohhh okay unary tuple hey girl
1 parent 27e78b9 commit 493f08e

File tree

1 file changed

+4
-7
lines changed
  • crates/processing_pyo3/src

1 file changed

+4
-7
lines changed

crates/processing_pyo3/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,18 @@ mod glfw;
1212
mod graphics;
1313

1414
use graphics::{Graphics, get_graphics, get_graphics_mut};
15-
use pyo3::{exceptions::PyRuntimeError, prelude::*, types::PyString};
15+
use pyo3::{exceptions::PyRuntimeError, prelude::*};
1616

1717
#[pymodule]
1818
fn processing(m: &Bound<'_, PyModule>) -> PyResult<()> {
1919
Python::attach(|py| {
2020
let sys = PyModule::import(py, "sys")?;
2121
let argv: Vec<String> = sys.getattr("argv")?.extract()?;
22+
let filename: &str = argv[0].as_str();
2223
let os = PyModule::import(py, "os")?;
2324
let path = os.getattr("path")?;
24-
let dirname = path
25-
.getattr("dirname")?
26-
.call1(pyo3::types::PyTuple::new(py, &[&argv[0]])?)?;
27-
let abspath = path
28-
.getattr("abspath")?
29-
.call1(pyo3::types::PyTuple::new(py, &[dirname])?)?;
25+
let dirname = path.getattr("dirname")?.call1((filename,))?;
26+
let abspath = path.getattr("abspath")?.call1((dirname,))?;
3027
let abspath = path.getattr("join")?.call1((abspath, "assets"))?;
3128

3229
m.add("_root_dir", abspath)?;

0 commit comments

Comments
 (0)