[vtkusers] python reader.GetFileName() seg faults

Chris Myers myers at tc.cornell.edu
Thu Jul 27 13:47:14 EDT 2000


On Thu, 27 Jul 2000, Randy Heiland wrote:
> 
> Actually, I just tried it using:
> 
> Python 1.5.2 (#10, Jan  4 2000, 08:17:24) [C] on irix646
> 
> and it worked too.  Not sure what 1.5.2 build you were using.  Guess I'd
> recommend that you update your Python - which would mean rebuilding VTK :(
> Of course, I don't thoroughly understand your predicament.  Why can't you just
> set a dummy filename and check for it later?

I see this problem both under Linux (with the Redhat 6.2 installed
version of Python):

Python 1.5.2 (#1, Feb  1 2000, 16:32:16)  [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386

and under Windows:

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32

I don't know why we're seeing different things.

I've tried a similar test out with a very simple (non-VTK) Python
extension that tries to return a NULL string (i.e.,
PyString_FromString on a NULL pointer), and that seg faults too
(unless I insert code to check whether the pointer is NULL).

As for my predicament, you are correct, there are certainly other ways
around the particular call to GetFileName() that is failing.  I did
want to report this less-than-optimal behavior (I'll refrain from
calling it a "bug"), but can also see ways around this particular
limitation of the Python-VTK interface.  (Specifically, in this case,
I am reading data from files in order to populate and attach optional
attributes to a VTK dataset.  What I do downstream in VTK depends on
whether or not those attribute data actually exist, and I was checking
on the attribute file names to see if those data had been attached.
Obviously, I can query the VTK dataset directly to see whether it has
various attribute data attached instead of checking whether the 
associated filename has been set.)

Thanks again for your help,

Chris







More information about the vtkusers mailing list