'NameError: name 'exit' is not defined neo

I am trying to run the code, but i have an error NameError: name 'exit' is not defined

import neo
import numpy as np
import mne
from matplotlib import pyplot as plt
from scipy.fft import fft

reader = neo.io.Spike2IO(<'filename'>) 
data = reader.read(lazy=False)[0].segments[0] 
SF = float(data.analogsignals[0].sampling_rate) #int(round())
arr = np.array(data.analogsignals[0][:, 0]).flatten()
info = mne.create_info(['EEG1'], sfreq=SF, ch_types=['eeg'])
raw = mne.io.RawArray(arr.reshape((1, -1)), info)
SF = round(SF)
raw.resample(SF, npad='auto')
arr = raw.get_data().flatten()

the error appears immediately after the execution of the line: reader = neo.io.Spike2IO('filename')

it outputs the file structure to the terminal, and then the code does not want to be executed.

I use Google Collab, but in VSCode it also doesn't work (although before that, on another computer that I don't have access to right now, it works fine and now I wonder what the problem is (VSCode))

full text or error:

NameError                                 Traceback (most recent call last)
<ipython-input-8-ec7d748b28bf> in <module>()
      1 #
----> 2 reader = neo.io.Spike2IO(<'filename'>)
      3 data = reader.read(lazy=False)[0].segments[0] 
      4 SF = float(data.analogsignals[0].sampling_rate) #int(round())
      5 arr = np.array(data.analogsignals[0][:, 0]).flatten()

3 frames
/usr/local/lib/python3.7/dist-packages/neo/rawio/spike2rawio.py in _parse_header(self)
     66                 from pprint import pprint
     67                 pprint(chan_info)
---> 68                 exit()
     69 
     70 

NameError: name 'exit' is not defined

thank you in advance



Solution 1:[1]

After looking at the relevant library: Neo, especially script pointed by at error traceback (neo/rawio/spike2rawio.py) it can be seen that the code is different and there is no problematic exit() in it. Try updating your library to newest official version and see if that fixes the problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 matszwecja