trouble with pyvtk

L

LokiDawg

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?
 
O

obaudys

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

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?

This could be very well be a bug where infinite recursion happens, but
see if changing the recursion limit fixes this:

Regards,
Ondrej
 
L

LokiDawg

This could be very well be a bug where infinite recursion happens, but
see if changing the recursion limit fixes this:
Regards,
Ondrej
Thanks for the tip, Ondrej. Unfortunately, this didn't do it, as pytvk
still ends up at the same place:

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 would be interested if anyone else has this difficulty with pyvtk--
Regards, Rolf
 
G

Gabriel Genellina

Thanks for the tip, Ondrej. Unfortunately, this didn't do it, as pytvk
still ends up at the same place:

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

This looks like either a bug on pyvtk or maybe you making a circular
reference to something - either way I think you'll get more help from the
package developers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top