Skip to content

Path to python is hardcoded

The code for Figure::save expects python to be located at /usr/local/bin/python3, which is not always the case. When not found, the raised error could be more explicit.

thread 'main' panicked at 'failed to execute process: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:1009:5

I suggest to at least add a line to inform the user of this issue, which can then easily be fixed with a symlink, e.g.

@@ -106,6 +106,7 @@ impl Figure {
         tmpfile.write_all(self.script.as_bytes());
         print!("{:?}", self.script);
 
+        fs::metadata("/usr/local/bin/python3").expect("python binary not found at /usr/local/bin/python3");
         let mut echo_hello = Command::new("/usr/local/bin/python3");
         echo_hello.arg(tmpfile.path());
         echo_hello.output().expect("failed to execute process");