Skip to content

Commit 2bb3ac2

Browse files
authored
Improve error message for overwrite (#13233)
1 parent c18908c commit 2bb3ac2

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved error message in :meth:`mne.io.Raw.save` when attempting to overwrite a file, by :newcontrib:`Sebastian Jentschke`

doc/changes/names.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@
272272
.. _Scott Huberty: https://orcid.org/0000-0003-2637-031X
273273
.. _Sebastiaan Mathot: https://www.cogsci.nl/smathot
274274
.. _Sebastian Castano: https://github.com/jscastanoc
275+
.. _Sebastian Jentschke: https://github.com/sjentsch
275276
.. _Sebastian Major: https://github.com/major-s
276277
.. _Sena Er: https://github.com/sena-neuro
277278
.. _Senwen Deng: https://snwn.de

mne/io/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,9 +1792,10 @@ def save(
17921792

17931793
split_size = _get_split_size(split_size)
17941794
if not self.preload and fname in self.filenames:
1795+
extra = " and overwrite must be True" if not overwrite else ""
17951796
raise ValueError(
1796-
"You cannot save data to the same file. Please use a different "
1797-
"filename."
1797+
"In order to save data to the same file, data need to be preloaded"
1798+
+ extra
17981799
)
17991800

18001801
if self.preload:

0 commit comments

Comments
 (0)