diff --git a/src/erg_common/python_util.rs b/src/erg_common/python_util.rs index d3b62283..2dd8f7fd 100644 --- a/src/erg_common/python_util.rs +++ b/src/erg_common/python_util.rs @@ -11,10 +11,14 @@ pub fn which_python() -> String { .arg(python) .output() .expect("python not found"); - String::from_utf8(out.stdout) + let res = String::from_utf8(out.stdout) .unwrap() .replace("\n", "") - .replace("\r", "") + .replace("\r", ""); + if res == "" { + panic!("python not found"); + } + res } pub fn detect_magic_number() -> u32 { @@ -28,7 +32,6 @@ pub fn detect_magic_number() -> u32 { .output() .expect("cannot get the magic number from python"); let s_hex_magic_num = String::from_utf8(out.stdout).unwrap(); - dbg!(&s_hex_magic_num); let first_byte = u8::from_str_radix(&s_hex_magic_num[0..=1], 16).unwrap(); let second_byte = u8::from_str_radix(&s_hex_magic_num[2..=3], 16).unwrap(); get_magic_num_from_bytes(&[first_byte, second_byte, 0, 0])