From b8e6c1806547e160c3fd8514867711f2fa336b74 Mon Sep 17 00:00:00 2001 From: ychenfo Date: Mon, 27 Dec 2021 03:21:32 +0800 Subject: [PATCH] nac3artiq: beautify python file path --- nac3artiq/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nac3artiq/src/lib.rs b/nac3artiq/src/lib.rs index b0e3625f..4c39a49f 100644 --- a/nac3artiq/src/lib.rs +++ b/nac3artiq/src/lib.rs @@ -91,9 +91,11 @@ impl Nac3 { ) -> PyResult<()> { let (module_name, source_file) = Python::with_gil(|py| -> PyResult<(String, String)> { let module: &PyAny = module.extract(py)?; + let os_mod = PyModule::import(py, "os")?; + let path_fun = os_mod.getattr("path")?.getattr("abspath")?; Ok(( module.getattr("__name__")?.extract()?, - module.getattr("__file__")?.extract()?, + path_fun.call1((module.getattr("__file__")?,))?.extract()? )) })?;