TypeError: Argument given by name ('attribList') and position (3)

I am trying to use wxVTKRenderWindowInteractor (a class from the VTK project). This might be a question for the VTK guys, but I think it is more of a wx/wx version thing.

When I run david.py (attached), I get:

[doriad@davedesktop wx]$ python david.py

Traceback (most recent call last):

File “david.py”, line 13, in

widget = wxVTKRenderWindowInteractor(frame, -1)

File “/home/doriad/bin/VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py”, line 175, in init

attribList=attribList)

File “/home/doriad/src/wxPython/wx/glcanvas.py”, line 106, in init

_glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args, **kwargs))

TypeError: Argument given by name (‘attribList’) and position (3)

(wxVTKRenderWindowInteractor.py is attached for reference, but probably not helpful to actually run this if you don’t have VTK installed)

Does this seem like a problem that would be caused by having a different version of wxPython built from what VTK is expecting?

Thanks,

David

david.py (717 Bytes)

wxVTKRenderWindowInteractor.py (24.5 KB)

Yes. What version of wxPython are you using?

···

On 2/25/10 8:38 AM, David Doria wrote:

I am trying to use wxVTKRenderWindowInteractor (a class from the VTK
project). This might be a question for the VTK guys, but I think it is
more of a wx/wx version thing.

When I run david.py (attached), I get:

[doriad@davedesktop wx]$ python david.py
Traceback (most recent call last):
   File "david.py", line 13, in <module>
     widget = wxVTKRenderWindowInteractor(frame, -1)
   File
"/home/doriad/bin/VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py",
line 175, in __init__
     attribList=attribList)
   File "/home/doriad/src/wxPython/wx/glcanvas.py", line 106, in __init__
     _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args,
**kwargs))
TypeError: Argument given by name ('attribList') and position (3)

(wxVTKRenderWindowInteractor.py is attached for reference, but probably
not helpful to actually run this if you don't have VTK installed)

Does this seem like a problem that would be caused by having a different
version of wxPython built from what VTK is expecting?

--
Robin Dunn
Software Craftsman

2.9 from svn, just installed this morning.

Thanks,

David

···

On Thu, Feb 25, 2010 at 4:13 PM, Robin Dunn robin@alldunn.com wrote:

On 2/25/10 8:38 AM, David Doria wrote:

I am trying to use wxVTKRenderWindowInteractor (a class from the VTK

project). This might be a question for the VTK guys, but I think it is

more of a wx/wx version thing.

When I run david.py (attached), I get:

[doriad@davedesktop wx]$ python david.py

Traceback (most recent call last):

File “david.py”, line 13, in

 widget = wxVTKRenderWindowInteractor(frame, -1)

File

“/home/doriad/bin/VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py”,

line 175, in init

 attribList=attribList)

File “/home/doriad/src/wxPython/wx/glcanvas.py”, line 106, in init

 _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args,

**kwargs))

TypeError: Argument given by name (‘attribList’) and position (3)

(wxVTKRenderWindowInteractor.py is attached for reference, but probably

not helpful to actually run this if you don’t have VTK installed)

Does this seem like a problem that would be caused by having a different

version of wxPython built from what VTK is expecting?

Yes. What version of wxPython are you using?

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,

I am trying to use wxVTKRenderWindowInteractor (a class from the VTK
project). This might be a question for the VTK guys, but I think it is
more of a wx/wx version thing.

When I run david.py (attached), I get:

[doriad@davedesktop wx]$ python david.py
Traceback (most recent call last):
File "david.py", line 13, in <module>
widget = wxVTKRenderWindowInteractor(frame, -1)
File

"/home/doriad/bin/VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py",
line 175, in __init__
attribList=attribList)
File "/home/doriad/src/wxPython/wx/glcanvas.py", line 106, in __init__
_glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args,
**kwargs))
TypeError: Argument given by name ('attribList') and position (3)

(wxVTKRenderWindowInteractor.py is attached for reference, but probably
not helpful to actually run this if you don't have VTK installed)

Does this seem like a problem that would be caused by having a different
version of wxPython built from what VTK is expecting?

Yes. What version of wxPython are you using?

2.9 from svn, just installed this morning.
Thanks,

I strongly suggest you to go back to 2.8.10.1. VTK is a huge ba****d
of a library, and recent changes on GLCanvas may have broken the shaky
links between the C++ code and the Python bindings. I use it every day
to visualize results on 3D reservoir fluid flow simulations and never
had any problem, *as long as* I stay with wxPython 2.8. When 2.9 (or
3.0) will come out officially as "stable" Charles Botha will take a
look at whatever issue have arisen with between VTK and wx.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 25 February 2010 21:30, David Doria wrote:

On Thu, Feb 25, 2010 at 4:13 PM, Robin Dunn <robin@alldunn.com> wrote:

On 2/25/10 8:38 AM, David Doria wrote:

Here's the difference in the wxGLCanvas constructor APIs.

In 2.8:

     wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize, long style = 0,
                const wxString& name = wxPyGLCanvasNameStr,
                int *attribList = NULL,
                const wxPalette& palette = wxNullPalette);

In 2.9:

     wxGLCanvas(wxWindow *parent,
                wxWindowID id = -1,
                const int *attribList = NULL,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = 0,
                const wxString& name = wxPyGLCanvasNameStr,
                const wxPalette& palette = wxNullPalette);

So as you can see the position of the attribList parameter has changed. Changing the call in wxVTKRenderWindowInteractor to use keywords for all the args will probably allow it to work for both, however I'm not sure whether there will be other problems between 2.9 and vtk.

···

On 2/25/10 1:37 PM, Andrea Gavana wrote:

Hi,

On 25 February 2010 21:30, David Doria wrote:

On Thu, Feb 25, 2010 at 4:13 PM, Robin Dunn<robin@alldunn.com> wrote:

On 2/25/10 8:38 AM, David Doria wrote:

I am trying to use wxVTKRenderWindowInteractor (a class from the VTK
project). This might be a question for the VTK guys, but I think it is
more of a wx/wx version thing.

When I run david.py (attached), I get:

[doriad@davedesktop wx]$ python david.py
Traceback (most recent call last):
   File "david.py", line 13, in<module>
     widget = wxVTKRenderWindowInteractor(frame, -1)
   File

"/home/doriad/bin/VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py",
line 175, in __init__
     attribList=attribList)
   File "/home/doriad/src/wxPython/wx/glcanvas.py", line 106, in __init__
     _glcanvas.GLCanvas_swiginit(self,_glcanvas.new_GLCanvas(*args,
**kwargs))
TypeError: Argument given by name ('attribList') and position (3)

(wxVTKRenderWindowInteractor.py is attached for reference, but probably
not helpful to actually run this if you don't have VTK installed)

Does this seem like a problem that would be caused by having a different
version of wxPython built from what VTK is expecting?

Yes. What version of wxPython are you using?

2.9 from svn, just installed this morning.

--
Robin Dunn
Software Craftsman

Here’s the difference in the wxGLCanvas constructor APIs.

In 2.8:

wxGLCanvas(wxWindow *parent, wxWindowID id = -1,

           const wxPoint& pos = wxDefaultPosition,

           const wxSize& size = wxDefaultSize, long style = 0,

           const wxString& name = wxPyGLCanvasNameStr,

           int *attribList = NULL,

           const wxPalette& palette = wxNullPalette);

In 2.9:

wxGLCanvas(wxWindow *parent,

           wxWindowID id = -1,

           const int *attribList = NULL,

           const wxPoint& pos = wxDefaultPosition,

           const wxSize& size = wxDefaultSize,

           long style = 0,

           const wxString& name = wxPyGLCanvasNameStr,

           const wxPalette& palette = wxNullPalette);

So as you can see the position of the attribList parameter has changed. Changing the call in wxVTKRenderWindowInteractor to use keywords for all the args will probably allow it to work for both, however I’m not sure whether there will be other problems between 2.9 and vtk.

Robin Dunn

Software Craftsman

http://wxPython.org

Ok, looks like we’ve definitely nailed down the problem. I tried to start over and build wxWidgets2.8 and wxPython2.8. wxWidgets seemed to go fine. I ran into some problems trying to build wxPython.

It seems like I need to add

/opt/wx/2.8/lib/wx/include/gtk2-ansi-debug-2.8

and

/opt/wx/2.8/include/wx-2.8

to my CPLUS_INCLUDE_PATH because it was complaining that it couldn’t find things like “wx/setup.h”

After doing this, when I run:

python setup.py build_ext --inplace --debug

There are zillions of errors. I uploaded the output here: http://rpi.edu/~doriad/output.txt

My process was the following:

  1. check out http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH/ to ~/src/wxWidgets

  2. check out http://svn.wxwidgets.org/svn/wx/wxPython/branches/WX_2_8_BRANCH/ to ~/src/wxPython

  3. from ~/src/wxWidgets, run:

./configure --prefix=/opt/wx/2.8 --with-gtk --with-gnomeprint --with-opengl --enable-debug --enable-debug_gdb --enable-geometry --enable-graphics_ctx --enable-sound --with-sdl --enable-mediactrl --enable-display

  1. put this in .make

make $* \

&& make -C contrib/src/gizmos $* \

&& make -C contrib/src/stc $*

  1. chmod a+rwx .make

  2. sudo ./.make

  3. sudo ./.make install

  4. from src/wxPython, run:

python setup.py build_ext --inplace --debug

Sorry to be such a pain, but maybe someone can tell from these errors what I’ve done wrong?

Thanks,

David

Ok, looks like we've definitely nailed down the problem. I tried to
start over and build wxWidgets2.8 and wxPython2.8. wxWidgets seemed to
go fine. I ran into some problems trying to build wxPython.

It seems like I need to add
/opt/wx/2.8/lib/wx/include/gtk2-ansi-debug-2.8
and
/opt/wx/2.8/include/wx-2.8

to my CPLUS_INCLUDE_PATH because it was complaining that it couldn't
find things like "wx/setup.h"

When a valid wx-config is found that matches the options that are requested then that won't be necessary.

After doing this, when I run:
python setup.py build_ext --inplace --debug

There are zillions of errors. I uploaded the output here:
http://rpi.edu/~doriad/output.txt

My process was the following:

1) check out
http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH/ to
~/src/wxWidgets
2) check out
http://svn.wxwidgets.org/svn/wx/wxPython/branches/WX_2_8_BRANCH/ to
~/src/wxPython
3) from ~/src/wxWidgets, run:
./configure --prefix=/opt/wx/2.8 --with-gtk --with-gnomeprint
--with-opengl --enable-debug --enable-debug_gdb --enable-geometry
--enable-graphics_ctx --enable-sound --with-sdl --enable-mediactrl
--enable-display
4) put this in .make
make $* \
&& make -C contrib/src/gizmos $* \
&& make -C contrib/src/stc $*
5) chmod a+rwx .make
6) sudo ./.make
7) sudo ./.make install
8) from src/wxPython, run:
python setup.py build_ext --inplace --debug

Sorry to be such a pain, but maybe someone can tell from these errors
what I've done wrong?

Either add --enable-unicode to the configure step and rebuild wxWidgets, or add UNICODE=0 to the setup.py command line.

···

On 2/25/10 4:18 PM, David Doria wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org

When a valid wx-config is found that matches the options that are requested then that won’t be necessary.

Either add --enable-unicode to the configure step and rebuild wxWidgets, or add UNICODE=0 to the setup.py command line.

Robin Dunn

Software Craftsman

http://wxPython.org

Robin,

Right again! Last step…

I can run demo.py, so I guess my wxPython is working. However, when I try to run a basic VTK+wxPython script:

import math, os, sys

import wx

import vtk

from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor

every wx app needs an app

app = wx.PySimpleApp()

create the top-level frame, sizer and wxVTKRWI

frame = wx.Frame(None, -1, “wxRenderWindow”, size=wx.Size(400,400))

Add the wxVTKRenderWindowInteractor

widget = wxVTKRenderWindowInteractor(frame, -1)

widget.Enable(1)

Add a VTKRenderer

ren = vtk.vtkRenderer()

widget.GetRenderWindow().AddRenderer(ren)

You need to ad a sizer so that the widget will fit the frame

sizer = wx.BoxSizer(wx.VERTICAL)

sizer.Add(widget, 1, wx.EXPAND)

frame.SetSizer(sizer)

frame.Layout()

Now make the frame show

frame.Show()

start the app

app.MainLoop()

I just get “Segmentation fault”. I believe that should be working code - how would I go about figuring out what is causing the segfault? It occurs once app.MainLoop() starts (I commented that line and there was no error).

Thanks for all of your help so far,

David

You can load the core file produced byt the segfault into gdb and do a bt command. If there is debug info for all the stack frames you should see the call stack, with all the function names and parameters, up to the point of the crash.

···

On 2/25/10 6:03 PM, David Doria wrote:

I just get "Segmentation fault". I believe that should be working code -
how would I go about figuring out what is causing the segfault? It
occurs once app.MainLoop() starts (I commented that line and there was
no error).

--
Robin Dunn
Software Craftsman

Robin,

I have never done anything like this. I am trying to follow this tutorial:

http://www.network-theory.co.uk/articles/gccdebug.html

But it doesn’t seem to produce a ‘core’ file in the current directory. In c++, I would try to compile with -g, but there is no compiling in python… so what can I do?

Thanks,

David

···

On Fri, Feb 26, 2010 at 1:08 PM, Robin Dunn robin@alldunn.com wrote:

On 2/25/10 6:03 PM, David Doria wrote:

I just get “Segmentation fault”. I believe that should be working code -

how would I go about figuring out what is causing the segfault? It

occurs once app.MainLoop() starts (I commented that line and there was

no error).

You can load the core file produced byt the segfault into gdb and do a bt command. If there is debug info for all the stack frames you should see the call stack, with all the function names and parameters, up to the point of the crash.

Robin Dunn

    You can load the core file produced by the segfault into gdb and do
    a bt command. If there is debug info for all the stack frames you
    should see the call stack, with all the function names and
    parameters, up to the point of the crash.
    --
    Robin Dunn

Robin,

I have never done anything like this. I am trying to follow this tutorial:
http://www.network-theory.co.uk/articles/gccdebug.html

But it doesn't seem to produce a 'core' file in the current directory.

It's possible that the generation of core files is turned off. Try running "ulimit -c unlimited" and then run the python code that is crashing again.

In c++, I would try to compile with -g, but there is no compiling in
python... so what can I do?

It's whether Python and the wxPython and vtk extension modules were built with -g that matters in this case.

···

On 2/26/10 11:01 AM, David Doria wrote:

On Fri, Feb 26, 2010 at 1:08 PM, Robin Dunn <robin@alldunn.com >

--
Robin Dunn
Software Craftsman

Here is a link to the script I am running and the backtrace it produces:

http://www.rpi.edu/~doriad/wxPython/

Can you make anything of this?

Thanks,

David

Sorry, I know very little about VTK and that's what is at the top of the call stack (the code that was executing just before the crash.) You'll probably need to talk to them about this.

···

On 2/26/10 7:07 PM, David Doria wrote:

Here is a link to the script I am running and the backtrace it produces:
http://www.rpi.edu/~doriad/wxPython/

Can you make anything of this?

--
Robin Dunn
Software Craftsman
http://wxPython.org