[ase-users] Fwd: error with isinstance

Oscar Xavier Guerrero oscarxavier.ox at gmail.com
Fri Jan 13 03:45:33 CET 2017


Forgot to include ase-users

---------- Forwarded message ----------
From: Oscar Xavier Guerrero <oscarxavier.ox at gmail.com>
Date: 2017-01-12 20:42 GMT-06:00
Subject: Re: [ase-users] error with isinstance
To: Gaël Donval <G.Donval at bath.ac.uk>


Hi,
I'm using Anaconda's editor Spyder, I found out that the 'error' occurs
when ase.atom is reloaded. When the script is rerun it reloads that module,
was able to reproduce it with the reload function.

Here's an example with Anaconda and without of Anaconda:

Python 3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul  2 2016, 17:53:06)
> [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from imp import reload
> >>> import ase
> >>> from ase.atom import Atom
> >>> a = Atom()
> >>> isintance(a, Atom)
> True
> >>> reload(ase.atom)
> <module 'ase.atom' from '/software/easybuild/software/
> ASE/3.9.1.4567-intel-2015B-Python-2.7.10/lib/python2.7/site-
> packages/ase/atom.py'>
> >>> from ase.atom import Atom
> >>> isintance(a, Atom)
> False



Python 2.7.10 (default, May 17 2016, 10:28:57)
> [GCC Intel(R) C++ gcc 4.8 mode] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from imp import reload
> >>> import ase
> >>> from ase.atom import Atom
> >>> a = Atom()
> >>> isintance(a, Atom)
> True
> >>> reload(ase.atom)
> <module 'ase.atom' from '/software/easybuild/software/
> ASE/3.9.1.4567-intel-2015B-Python-2.7.10/lib/python2.7/site-
> packages/ase/atom.py'>
> >>> from ase.atom import Atom
> >>> isintance(a, Atom)
> False







2017-01-12 4:24 GMT-06:00 Gaël Donval via ase-users <
ase-users at listserv.fysik.dtu.dk>:

> Hi,
> > 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.
>
> Would it be possible to provide a minimum (non-)working example?
>
> Gaël
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170112/ffc23d5f/attachment.html>


More information about the ase-users mailing list