-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix eeglab export rawarray filenames #10927
fix eeglab export rawarray filenames #10927
Conversation
Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴🏽♂️ |
mne/export/_eeglab.py
Outdated
try: | ||
if not (raw.filenames[0].endswith('.fif')): | ||
drop_chs.append('STI 014') | ||
except AttributeError: # mne.io.RawArray has no filenames attribute | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd be more comfortable with:
try: | |
if not (raw.filenames[0].endswith('.fif')): | |
drop_chs.append('STI 014') | |
except AttributeError: # mne.io.RawArray has no filenames attribute | |
pass | |
# RawArray doesn't have `filenames` attribute | |
if hasattr(raw, 'filenames') and not raw.filenames[0].endswith('.fif'): | |
drop_chs.append('STI 014') |
the except Error: pass
pattern always makes me nervous that silent bugs might slip through
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, there is a misunderstanding by my comment.
RawArray has filenames attribute but RawArray.filenames[0]==None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nitpick
🙏 @0Reza
🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪 |
thx @0Reza |
Reference issue
No filenames Attribute in mne.io.RawArray #10921
What does this implement/fix?
Add a try-except structure to catch the AttributeError and do nothing.
Additional information