Skip to content

Removing non-existing directory in example2 #1

@Wanpaku

Description

@Wanpaku

You're removing non-existing directory in the main function:

fn main() -> Result<(), Box<dyn Error>> {
    let mut dir = env::temp_dir();

    dir.push("tf-rust-example-xor-saved-model");
    

    fs::remove_dir_all(&dir)?; //<- The directory isn't created yet.

    train(&dir)?;

    eval(&dir)?;

    Ok(())
}

And therefore appears the error:
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

You need replace it after the eval or add something like:

if Path::new(&dir).is_dir(){
    fs::remove_dir_all(&dir)?;
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions