[ase-users] super subroutine on old python versions
Astrid Nikodem
nikodem at theochem.tu-muenchen.de
Thu Aug 11 17:12:48 CEST 2011
Hi all,
When I run a calculation using some of the old constraint routines (like
fix_cartesian), I got for the initialization of it the following error
message:
> Traceback (most recent call last):
> File "test.py", line 19, in <module>
> fg = fix_cartesian(1,mask=[1,0,1])
> File ".../ase/constraints.py", line 336, in __init__
> super(fix_cartesian, self).__init__(a, mask)
> TypeError: super() argument 1 must be type, not classobj
The same appears at the super statement in the Turbomole calculator
wrapper, when for the first time set_atoms is called. This seems to be a
problem with older python versions (I use 2.5.2 and 2.6.4), which have a
different default class than the newer ones.
Thus if I explicitly make the parent class an object the errors
disappeared. This would be the FixConstraint class for the constraint
routines and the Calculator class for Turbomole.
Best wishes,
A. Nikodem
diff -rN -u old-python-3.5.0/ase/constraints.py
new-python-3.5.0/ase/constraints.py
--- old-python-3.5.0/ase/constraints.py 2011-08-11 16:11:54.000000000 +0200
+++ new-python-3.5.0/ase/constraints.py 2011-08-11 16:11:54.000000000 +0200
@@ -22,7 +22,7 @@
start = s.start
return enumerate(range(start, s.stop, step))
-class FixConstraint:
+class FixConstraint(object):
"""Base class for classes that fix one or more atoms in some way."""
def index_shuffle(self, ind):
diff -rN -u old-python-3.5.0/ase/calculators/general.py
new-python-3.5.0/ase/calculators/general.py
--- old-python-3.5.0/ase/calculators/general.py 2011-08-11
16:11:54.000000000 +0200
+++ new-python-3.5.0/ase/calculators/general.py 2011-08-11
16:11:54.000000000 +0200
@@ -1,5 +1,5 @@
-class Calculator:
+class Calculator(object):
def __init__(self):
return
More information about the ase-users
mailing list