# Error in brain.add\_sensors

**URL:** <https://mne.discourse.group/t/error-in-brain-add-sensors/11366>\
**Category:** Support & Discussions\
**Tags:** visualization\
**Created:** [July 16, 2025, 2:15pm UTC](https://mne.discourse.group/t/error-in-brain-add-sensors/11366 "2025-07-16T14:15:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CamilleFakche](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/camillefakche/32/3209_2.png) [@CamilleFakche](https://mne.discourse.group/u/CamilleFakche)\
**Post date:** [July 16, 2025, 2:15pm UTC](https://mne.discourse.group/t/error-in-brain-add-sensors/11366/1 "2025-07-16T14:15:18Z")

</div>

Hi MNE community,

I’m working with sEEG data and aiming to visualize the localization of sEEG shafts on the individual’s brain. I was using the script below, which used to work fine, but it suddenly stopped working.

- MNE version: 1.9.0
- operating system: Windows 11

```python
# Estimate head -> mri transform
    subj_trans = mne.coreg.estimate_head_mri_t('sub'+ListSuj[suj], dirFreeSurfer)   
    trans_filename = dirData+'subject'+ListSuj[suj]+'/subject'+ListSuj[suj]+'_trans.fif'
    mne.write_trans(trans_filename, subj_trans)
    # Load sEEG Data
    sEEG_File = dirData+'subject'+ListSuj[suj]+'/subject'+ListSuj[suj]+'_order1.fif'
    sEEG_Data = mne.io.read_raw(sEEG_File, preload=True)   
    # Plot
    brain = mne.viz.Brain('sub'+ListSuj[suj], hemi='both', surf='pial', subjects_dir=dirFreeSurfer)
    # Add elec
    brain.add_sensors(sEEG_Data.info, trans=trans_filename, seeg=True)

```

The error (below) seems to come from the trans argument. And is weird because I indeed give a str…

`TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'Transform'`

Any help is welcome 🙂

Camille

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [July 17, 2025, 8:05pm UTC](https://mne.discourse.group/t/error-in-brain-add-sensors/11366/2 "2025-07-17T20:05:21Z")

</div>

Funny error indeed. 🤔 Did you try to just pass `subj_trans` directly? That should work, too: [mne.viz.Brain — MNE 1.10.0 documentation](https://mne.tools/stable/generated/mne.viz.Brain.html#mne.viz.Brain.add_sensors)

I also advise to look into:

- [pathlib](https://realpython.com/python-pathlib/) and
- [fstring formatting](https://realpython.com/python-f-strings/)
