From 8923a763f80c4feb32a6eeec85183c46e7c65828 Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Tue, 10 Sep 2024 09:41:44 +0200 Subject: [PATCH] convert raw.filenames[0] to str in case it was a path --- mne/export/_eeglab.py | 2 +- mne/io/base.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mne/export/_eeglab.py b/mne/export/_eeglab.py index 607102901df..b12923a180c 100644 --- a/mne/export/_eeglab.py +++ b/mne/export/_eeglab.py @@ -18,7 +18,7 @@ def _export_raw(fname, raw): # remove extra epoc and STI channels drop_chs = ["epoc"] # filenames attribute of RawArray is filled with None - if raw.filenames[0] and not (raw.filenames[0].endswith(".fif")): + if raw.filenames[0] and not (str(raw.filenames[0]).endswith(".fif")): drop_chs.append("STI 014") ch_names = [ch for ch in raw.ch_names if ch not in drop_chs] diff --git a/mne/io/base.py b/mne/io/base.py index ee5603224b5..4f126613a37 100644 --- a/mne/io/base.py +++ b/mne/io/base.py @@ -276,7 +276,9 @@ def __init__( # STI 014 channel is native only to fif ... for all other formats # this was artificially added by the IO procedure, so remove it ch_names = list(info["ch_names"]) - if ("STI 014" in ch_names) and not (self.filenames[0].endswith(".fif")): + if ("STI 014" in ch_names) and not ( + str(self.filenames[0]).endswith(".fif") + ): ch_names.remove("STI 014") # Each channel in the data must have a corresponding channel in