[ase-users] error with isinstance

Oscar Xavier Guerrero oscarxavier.ox at gmail.com
Thu Jan 12 01:33:57 CET 2017


Hello,

I don't know if this is a bug or an overlook on my part.
I'm writing some code and I'm getting errors caused by a wrongful
evaluation of the isinstance function in the ase code. The error occurs
when I have an ase.atoms.Atom object, lets call it atom, and I rerun a
script that reloads ase modules, then isinstance(atom, ase.atoms.Atom) will
return False.

I noticed this happening when trying to extend an atoms object and when
trying to write the object to file, specifically here:

*ase/atoms.py*, line 862, in extend

        if isinstance(other, Atom):


*ase/io/formats.py*, line 233, in _write

    if isinstance(images, Atoms):


a misevaluation here leads to different errors later in the code caused by
a call to len().

This has been very bothersome since I have to constantly restart the kernel
to avoid these errors. Is there another way to avoid it?


Thank you in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170111/6bc7c04c/attachment-0001.html>


More information about the ase-users mailing list