-
Notifications
You must be signed in to change notification settings - Fork 75
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
NetCDF tempfile handling broken on windows #24
Comments
I am going to be that Windows user... Any fixes/workarounds for this yet? |
Well, the workaround would be to use However, if fixing this would be a boon to your use of siphon, I'm much more inclined to fix it if know I have actual, not hypothetical, user(s) needing it. |
@dopplershift See this pvlib-python issue for more info on how we want to use Siphon for solar power forecasts. We can also help address Siphon problems relevant to our work. |
also, @dopplershift, many thanks to you and Unidata for developing Siphon! |
Wow, that looks really cool. I'm glad you're finding Siphon so useful. In general, if you guys just open issues for problems you find (or better yet, PRs for fixes!), that will be great. For this issue, the big problem is that we're not windows devs on Siphon. I made windows 7 VM, but it was painful. It will definitely go faster if you can find a fix that works for you and make a PR. Otherwise, I can make a pass at a fix, but the testing loop on that will probably be much slower. |
I am not sure how you want to proceed but I have made a universal fix within the siphon code that deletes the temporary file upon exit, after setting the NamedTemporaryFile argument "delete" to False. This is also possible to do with less modifications to the Siphon code by deleting the temporary file using dataset.filepath() within our own code but it still requires that the "delete" argument equal False. However, both approaches require that the dataset be closed first. |
The sounds like the approach I took originally (never committed), until I realized that I could re-open the file (which made the code much cleaner); it's a shame that approach doesn't work on windows. I'll take a PR with your changes to add the exit handler |
Looks like another approach to solving this problem is here: |
Thanks @rsignell-usgs, that's very helpful. |
Fixed in #56. |
When using the NCSS client to open data we saved to a tempfile, we get a
RuntimeError
due to "Permission denied". I'm guessing Windows doesn't like someone opening the file a second time.We could try catching the error and opening a different way, but in that case it's a much bigger pain to ensure the file gets deleted. sigh Why can't windows just behave in a unix-like fashion?
This may be obviated once we get the in-memory solution in the netcdf library, but I think it will be awhile after that before it's widely available. Might punt on this until a windows user complains...
The text was updated successfully, but these errors were encountered: