You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.
On linux this works, but on Windows I receive the following error:
File "C:\Users\Karlson\Anaconda3\envs\chess-tuning-tools\lib\contextlib.py", line 119, in __exit__
next(self.gen)
File "C:\Users\Karlson\Anaconda3\envs\chess-tuning-tools\lib\site-packages\atomicwrites\__init__.py", line 169, in _open
self.commit(f)
File "C:\Users\Karlson\Anaconda3\envs\chess-tuning-tools\lib\site-packages\atomicwrites\__init__.py", line 202, in commit
replace_atomic(f.name, self._path)
File "C:\Users\Karlson\Anaconda3\envs\chess-tuning-tools\lib\site-packages\atomicwrites\__init__.py", line 99, in replace_atomic
return _replace_atomic(src, dst)
File "C:\Users\Karlson\Anaconda3\envs\chess-tuning-tools\lib\site-packages\atomicwrites\__init__.py", line 81, in _replace_atomic
_windows_default_flags | _MOVEFILE_REPLACE_EXISTING
File "C:\Users\Karlson\Anaconda3\envs\chess-tuning-tools\lib\site-packages\atomicwrites\__init__.py", line 76, in _handle_errors
raise WinError()
PermissionError: [WinError 5] Access is denied
The script is located in the home folder and should not be run with admin privileges.
I was able to reproduce the problem now using the following steps:
importnumpyasnpfromatomicwritesimportAtomicWriterarr=np.linspace(0, 1, num=10)
# Works without a problem:withAtomicWriter("test.npz", mode="wb", overwrite=True).open() asf:
np.savez_compressed(f, arr)
data=np.load("test.npz")
# PermissionError happens here:withAtomicWriter("test.npz", mode="wb", overwrite=True).open() asf:
np.savez_compressed(f, arr)
Reading up on numpy.load(), it turns out that in the case of .npz (i.e. compressed) files it actually opens the file and it needs to be explicitly closed again. I wonder why the PermissionError does not happen on Linux systems.
But since this is not an issue with atomicwrites, I will close the issue.
I write to a file as follows:
On linux this works, but on Windows I receive the following error:
The script is located in the home folder and should not be run with admin privileges.
Using the following versions:
The text was updated successfully, but these errors were encountered: