# Bug opening preprocessed data using mne with pickle

**URL:** <https://mne.discourse.group/t/bug-opening-preprocessed-data-using-mne-with-pickle/2208>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [June 1, 2020, 1:09pm UTC](https://mne.discourse.group/t/bug-opening-preprocessed-data-using-mne-with-pickle/2208 "2020-06-01T13:09:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [June 1, 2020, 1:09pm UTC](https://mne.discourse.group/t/bug-opening-preprocessed-data-using-mne-with-pickle/2208/1 "2020-06-01T13:09:10Z")

</div>

External Email - Use Caution

Hi community,

I preprocessed my EEG raw data using MNE functions and created a  
dictionnary for all files containing information about related bad  
epochs and bad channels. I save it as a .pkl file using a pickle  
function. This "preprocessed.pkl" file was the basis for all my further  
analyses and it was working well before. However, now when I try to open  
it using the pickle.load :

import mne  
import pyconscious as pc  
import pickle  
import numpy as np

filename = 'preprocessed.pkl'  
loadfile = open(filename,'rb')  
fileinfo = pickle.load(loadfile)  
loadfile.close()

I got an error message "ModuleNotFoundError: No module named  
'mne.\_digitization'". I don't understand where this comes from and when  
I preprocessed my data again all like before it is working, but I would  
like to be able to open my former preprocessing file for my analyses to  
go on the same basis.

Thank you very much for your attention to my bug. I hope you can help me  
figure this out !

Kind regards,

Marthe

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [June 1, 2020, 1:50pm UTC](https://mne.discourse.group/t/bug-opening-preprocessed-data-using-mne-with-pickle/2208/2 "2020-06-01T13:50:02Z")

</div>

External Email - Use Caution

> I got an error message "ModuleNotFoundError: No module named  
> 'mne.\_digitization'". I don't understand where this comes from and when I  
> preprocessed my data again all like before it is working, but I would like  
> to be able to open my former preprocessing file for my analyses to go on  
> the same basis.

See:

[https://mne.tools/stable/overview/faq.html#why-is-it-dangerous-to-pickle-my-mne-python-objects-and-data-for-later-use](https://mne.tools/stable/overview/faq.html#why-is-it-dangerous-to-pickle-my-mne-python-objects-and-data-for-later-use)

What I would recommend is that you temporarily go back to using whatever  
version of MNE you used to generate the files, and re-save them using  
`epochs.save`, `raw.save`, etc. rather than pickling them. It ensures  
forward and backward compatibility.

Eric  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200601/94dd01fb/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200601/94dd01fb/attachment.html)
