No module named 'mne.externals

Hi :slight_smile:

i get the following error “No module named 'mne.externals” when I try to run this code

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


import mne 
import mne_bids
import glob
from tkinter.filedialog import askdirectory
from pathlib import Path


# 1. Function Definitions


def tree(dir_path: Path, prefix: str=''):
    """A recursive generator, given a directory Path object
    will yield a visual tree structure line by line
    with each line prefixed by the same characters
    """    
    # prefix components:
    space =  '    '
    branch = '│   '
    # pointers:
    tee =    '├── '
    last =   '└── '

    contents = list(dir_path.iterdir())
    # contents each get pointers that are ├── with a final └── :
    pointers = [tee] * (len(contents) - 1) + [last]
    for pointer, path in zip(pointers, contents):
        yield prefix + pointer + path.name
        if path.is_dir(): # extend the prefix and recurse:
            extension = branch if pointer == tee else space 
            # i.e. space because last, └── , above so no more |
            yield from tree(path, prefix=prefix+extension)
            

This code did already run, but a while ago and I think it might be due to the migration of Jinja2.
I am not sure how to solve this problem. I am running python 3.8, mne 1.1.1, mne-bids 0.7

Thank you :slight_smile:
Franzi

Hello,

The module mne.externals was deprecated about 1.5 years ago, and removed in version 1.0. Thus all versions after 1.0 will not include it. You have 2 options:

In the code snippet you provide, I don’t see MNE, or mne.externals used anywhere.

Mathieu

Thank you :slight_smile: going back to 0.24 did the trick!