Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing non-existing directory in example2 #1

Open
Wanpaku opened this issue Jun 15, 2024 · 1 comment
Open

Removing non-existing directory in example2 #1

Wanpaku opened this issue Jun 15, 2024 · 1 comment

Comments

@Wanpaku
Copy link

Wanpaku commented Jun 15, 2024

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)?;
 }
@rosdec
Copy link
Owner

rosdec commented Jun 15, 2024

Hey, thank you for noticing this! Please create a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants