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

PermissionError: [WinError 32] by creating a cutout with era5 [atlite 0.0.4.dev335+gba5daae] #107

Closed
ced2205 opened this issue Nov 25, 2020 · 5 comments

Comments

@ced2205
Copy link

ced2205 commented Nov 25, 2020

Hi,
i am running the following code:

CODE

import atlite
import logging
logging.basicConfig(level=logging.INFO)

cutout = atlite.Cutout(path="HH-2019.nc",
                       module="era5",
                       x=slice(8.3, 11.37),
                       y=slice(52.5, 54.32),
                       time=slice("2019-01","2019-12")
                       )

cutout.prepare()

ERROR

the download process is executed as described in the documentation, but then appears the following Error:

Traceback (most recent call last):
  File "D:\Bachelorarbeit\conda\envs\atlite\lib\site-packages\atlite\data.py", line 146, in cutout_prepare
    fd, tmp = mkstemp(suffix=filename, dir=directory)
  File "D:\Bachelorarbeit\conda\envs\atlite\lib\tempfile.py", line 331, in mkstemp
    return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "D:\Bachelorarbeit\conda\envs\atlite\lib\tempfile.py", line 250, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: 'HH-2019-01-01\\tmp1jwrobky02.nc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/Bachelorarbeit/Bachelorarbeit/tryouts/try_atlite.py", line 12, in <module>
    cutout.prepare()
  File "D:\Bachelorarbeit\conda\envs\atlite\lib\site-packages\atlite\data.py", line 170, in cutout_prepare
    rmtree(tmpdir)
  File "D:\Bachelorarbeit\conda\envs\atlite\lib\shutil.py", line 737, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "D:\Bachelorarbeit\conda\envs\atlite\lib\shutil.py", line 615, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "D:\Bachelorarbeit\conda\envs\atlite\lib\shutil.py", line 613, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 32]The process cannot access the file because it is being used by another process: 'C:\\Users\\cedko\\AppData\\Local\\Temp\\tmp5dg_g04i\\tmp7g_scis6.nc'

Is there any known Bug generating this Error or is my PC causing this Error?

@euronion
Copy link
Collaborator

euronion commented Dec 1, 2020

Hi @ced2205 ,

Just to be sure: You installed and are using the v0.2 branch from GitHub, right?

There are no known bugs with windows for the cutout creation, but windows has always been giving us problems .
I'm running your example right now and am trying to reproduce the problem.

Side note: Which package version of pandas are you using (conda list)?

@euronion
Copy link
Collaborator

euronion commented Dec 1, 2020

I can reproduce the problem on my machine.

The error seems to be identical to #47 which should have been fixed in data.py, but the changes do not seem to be included in the branch.

We need to check this @coroa @fneum .

For @ced2205
You can specify a tmpdir= in cutout.prepare(tmpdir=...) . The preparation should then work without problems, temporary files however will not be deleted automatically and you will have to cleanup the tmpdir manually.

@ced2205
Copy link
Author

ced2205 commented Dec 2, 2020

@euronion

  • yes, i am using v0.2

  • i am using pandas v1.1.4

thank you! :)

@euronion
Copy link
Collaborator

euronion commented Dec 2, 2020

Thanks!

We'll look into it. Probably not in the near future as we are a bit stretched at the moment. Use the workaround for now.

@FabianHofmann
Copy link
Contributor

This bug is fixed now. Reopen the issue if you still encounter problems

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

No branches or pull requests

3 participants