Skip to content

Universe() should either work as Universe.empty() or raise an exception #2527

@Luthaf

Description

@Luthaf

Expected behavior

import MDAnalysis as mda
u = mda.Universe()
print(u)

Prints something sensible.

Actual behavior

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-f7a893c68ed4> in <module>
----> 1 print(u)

~/code/mdanalysis/package/MDAnalysis/core/universe.py in __repr__(self)
    775
    776         return "<Universe with {n_atoms} atoms>".format(
--> 777             n_atoms=len(self.atoms))
    778
    779     def __getstate__(self):

TypeError: object of type 'NoneType' has no len()

Currently version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)"): 0.20.2-dev0
  • Which version of Python (python -V)? Python 3.7.6
  • Which operating system? macOS 10.14.5

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