trouble with pyvtk

LokiDawg rsa4046 at gmail.com
Fri May 18 00:22:27 EDT 2007


Am trying to stumble through the demos for mayavi, after having set up
PyVTK-0.4.74 (together with numpy, scipy, vtk, and mayavi. I'm trying
to use pyvtk to generate a vtk dataset with the following:

>> from Numeric import *
>>> import scipy
>>> import scipy.special
>>> x = (arange(50.0)-25)/2.0
>>> y = (arange(50.0)-25)/2.0
>>> r = sqrt(x[:,NewAxis]**2+y**2)
>>> z = 5.0*scipy.special.j0(r)
>>> import pyvtk
>>> z1 = reshape(transpose(z), (-1,))
>>> point_data = pyvtk.PointData(pyvtk.Scalars(z1))
>>> grid = pyvtk.StructuredPoints((50,50, 1), (-12.5, -12.5, 0), (0.5, 0.5, 1))
>>> data = pyvtk.VtkData(grid, point_data)
>>> data.tofile('/tmp/test.vtk')

All is well until the last line (writing the file), after which the
following error occurs:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/pyvtk/__init__.py", line 195,
in tofile
    f.write(self.to_string(format))
  File "/usr/lib/python2.4/site-packages/pyvtk/__init__.py", line 177,
in to_string
    ret.append(self.point_data.to_string(format))
  File "/usr/lib/python2.4/site-packages/pyvtk/Data.py", line 47, in
to_string
    ret += [a.to_string(format) for a in self.data]
  File "/usr/lib/python2.4/site-packages/pyvtk/Scalars.py", line 40,
in to_string
    t = self.get_datatype(self.scalars)
  File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
    r = self.get_datatype(o)
  File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
    r = self.get_datatype(o)
  File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
    r = self.get_datatype(o)
  File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype

<snip> <snip> <snip> <snip>

  File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
    r = self.get_datatype(o)
  File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 140,
in get_datatype
    if is_int(obj): return self.default_int
RuntimeError: maximum recursion depth exceeded

I'm assuming my pyvtk installation is at issue here (?), but I don't
know enough about python to tell what has gone wrong, or how to fix
it. Can someone point me in the right direction?




More information about the Python-list mailing list