Skip to content

ChainReader cannot be pickled #1940

@orbeckst

Description

@orbeckst

Expected behaviour

ChainReader can be pickled like all the other Readers.

EDIT: not all readers can be pickled...

Actual behaviour

Raises TypeError because it contains a generator object

TypeError: can't pickle generator objects

See MDAnalysis/pmda#44

Code to reproduce the behaviour

import MDAnalysis as mda
import pickle

from MDAnalysis.tests.datafiles import TPR, XTC

u = mda.Universe(TPR, 3*[XTC])

s = pickle.dumps(u.trajectory, protocol=pickle.HIGHEST_PROTOCOL)

Currently version of MDAnalysis:

(run python -c "import MDAnalysis as mda; print(mda.__version__)")
0.18.1-dev

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions