Skip to content

Fix Nonetype has no attribute SetVisibility in _coreg.py [reopen of #13209] #13218

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

Merged
merged 10 commits into from
Apr 23, 2025

Conversation

psyxw
Copy link
Contributor

@psyxw psyxw commented Apr 17, 2025

What does this implement/fix?

For some CTF data, when passing inst='/path/to/fif' to mne.gui.coregistration(inst=inst), it will prompt "Nonetype has no attribute SetVisibility". This is because actors list contain None. A solution is to judge if actor in actors is None. (or using try-except).

I met this problem in mne-1.9.0 Windows 11 Python 3.12.10. I'm willing to provide related fif info file to reproduce the problem :)

psyxw and others added 6 commits April 13, 2025 19:57
For some CTF data, when passing inst='/path/to/fif' to mne.gui.coregistration(), it will prompt "Nonetype has no attribute SetVisibility", because actors list contain [None]. A solution is to judge if actor in actors is None. (or using try-except).
@larsoner
Copy link
Member

Can you share a data file that shows the problem? I tried:

coreg = mne.gui.coregistration(inst=mne.datasets.testing.data_path() / "CTF" / "somMDYO-18av.ds")

and the GUI came up okay on main.

@psyxw
Copy link
Contributor Author

psyxw commented Apr 18, 2025

Here is an info file. The info file is derived from OMEGA Dataset (CTF format). I read the data with mne.io.read_raw.ctf(), extract info and save. When passing this file to inst in mne.gui.coregistration(), an error Nonetype has no attribute SetVisibility prompts.

@larsoner
Copy link
Member

Hmmm I cannot reproduce the issue on main with:

>>> mne.gui.coregistration(inst="meg-01-info.fif", subject="fsaverage", subjects_dir=mne.datasets.sample.data_path() / "subjects")
Screencast.From.2025-04-18.09-37-37.mp4

Is it possible this has already been fixed on main? Did you try main or just the release version v1.9?

@psyxw
Copy link
Contributor Author

psyxw commented Apr 22, 2025

Sound interesting... I clone MNE-python in the main branch to my local disk, replace current version in python and run mne.gui.coregistration, the same error occurs.
If I print the actors, it is something like this:
[Actor (0x665d3520)...] [Actor (0x665d3520)...] [Actor (0x665d3520)...] [Actor (0x665d3520)...] ... [None]
The actors return a list, where the last elements is [None]
Here is a video. Thanks ;)

20250422_144652.mp4

@larsoner
Copy link
Member

Okay, not sure why it happens for you and not for me but safe enough to add the change, merged main into the branch to hopefully get CIs green and I'll mark for merge-when-green, thanks in advance @psyxw !

@larsoner larsoner enabled auto-merge (squash) April 23, 2025 15:23
@larsoner larsoner merged commit d089b45 into mne-tools:main Apr 23, 2025
30 checks passed
Copy link

welcome bot commented Apr 23, 2025

🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants