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

Check output filename extensions before writing #41

Open
cjordan opened this issue Feb 10, 2022 · 1 comment
Open

Check output filename extensions before writing #41

cjordan opened this issue Feb 10, 2022 · 1 comment

Comments

@cjordan
Copy link
Collaborator

cjordan commented Feb 10, 2022

I did something a little silly, but it exposed a poor error message:

# 1090008640.ms
birli *gpubox* -m *.metafits -u 1090008640.ms
# prints out
thread 'main' panicked at 'couldn't initialise uvfits writer: IO(Os { code: 21, kind: IsADirectory, message: "Is a directory" })', src/main.rs:1036:14

(I'm using the v0.5.0 branch and it failed on the line containing .expect("couldn't initialise uvfits writer"))

This error happens because the "file" already exists, and Rust notes that this is a directory when trying to initialise the output as a file. It would be good to have existing files checked and handled in this case, but also user input filenames checked; .ms files write as MS, .uvfits write as uvfits, etc.

@d3v-null
Copy link
Collaborator

d3v-null commented Jun 24, 2022

I agree that this would be handy, and we could probably copy the code from Hyperdrive that does this.

At least the error message is a bit nicer since Marlu 0.6.0 MWATelescope/Marlu@01d2393 , this has been merged in for release in v0.7.0

cannot create directory, path={path} already exists and is not a directory

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