Skip to content

Commit

Permalink
[MRG] FIX: Use os.replace instead of os.rename when copying CTF files…
Browse files Browse the repository at this point in the history
… (needed for windows) (#1035)

* fix: replace instead of rename for win support

* add changelog

* Update doc/whats_new.rst

Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
  • Loading branch information
sappelhoff and hoechenberger authored Aug 2, 2022
1 parent ace2a7d commit 491ac8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Detailed list of changes

- :func:`~mne_bids.read_raw_bids` doesn't populate ``raw.info['subject_info']`` with invalid values anymore, preventing users from writing the data to disk again, by `Richard Höchenberger`_ (:gh:`1031`)

- Writing and copying CTF files now works on Windows when files already exist (``overwrite=True``), by `Stefan Appelhoff`_ (:gh:`1035`)

:doc:`Find out what was new in previous releases <whats_new_previous_releases>`

.. include:: authors.rst
4 changes: 2 additions & 2 deletions mne_bids/copyfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def copyfile_ctf(src, dest):
bids_folder_name = op.splitext(op.split(dest)[-1])[0]
for fname in fnames:
ext = op.splitext(fname)[-1]
os.rename(op.join(dest, fname),
op.join(dest, bids_folder_name + ext))
os.replace(op.join(dest, fname),
op.join(dest, bids_folder_name + ext))


def copyfile_kit(src, dest, subject_id, session_id,
Expand Down

0 comments on commit 491ac8d

Please sign in to comment.