Skip to content

Error loading XDR files with corrupted offset files #3230

@yuxuanzhuang

Description

@yuxuanzhuang

Expected behavior

The offset file should be regenerated when the offset is corrupted.

Actual behavior

Unclear ValueError is raised.

~/anaconda3/envs/yzhuang/lib/python3.8/site-packages/numpy/lib/npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
    442             # Try a pickle
    443             if not allow_pickle:
--> 444                 raise ValueError("Cannot load file containing pickled data "
    445                                  "when allow_pickle=False")
    446             try:

ValueError: Cannot load file containing pickled data when allow_pickle=False

Code to reproduce the behavior

#/usr/bin/bash
# generate an empty npz file
touch .md.xtc_offsets.npz
import MDAnalysis as mda

u = mda.Universe('./md.pdb', './md.xtc')
....

Possible solution

Add an ValueError exception catch for read_numpy_offsets.

Note

This happened when I tried to process ~100 different trajectories parallelly, but it may not be related to #1988. Might just because I killed the same job beforehand and the offset files ended up corrupted. I will update if that's the case.

Current version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)") 2.0.0-dev
  • Which version of Python (python -V)? 3.8
  • Which operating system? Ubuntu

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions