# Any way to as an SIProxy to print it's server-side VTK object?

**URL:** https://discourse.paraview.org/t/any-way-to-as-an-siproxy-to-print-its-server-side-vtk-object/3614
**Category:** Development
**Created:** [February 20, 2020, 12:07pm UTC](https://discourse.paraview.org/t/any-way-to-as-an-siproxy-to-print-its-server-side-vtk-object/3614 "2020-02-20T12:07:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jondo2010](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jondo2010/32/2840_2.png) [@jondo2010](https://discourse.paraview.org/u/jondo2010)
#### Post date: [February 20, 2020, 12:07pm UTC](https://discourse.paraview.org/t/any-way-to-as-an-siproxy-to-print-its-server-side-vtk-object/3614/1 "2020-02-20T12:07:04Z")

</div>

This seems like a fairly obvious thing to want to do during development. I have a client-side SMProxy object in Python, and I’d like to ask the server-side vtkObject to PrintSelf(), for debugging purposes.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [February 20, 2020, 12:46pm UTC](https://discourse.paraview.org/t/any-way-to-as-an-siproxy-to-print-its-server-side-vtk-object/3614/2 "2020-02-20T12:46:12Z")

</div>

Adding a `<Property name="Print" command="Print" />` to the proxy definition and then calling that using `vtkSMProxy::InvokeCommand("Print")` is one of the ways to do it.

---

<div class="post-metadata">

### Author: ![jondo2010](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jondo2010/32/2840_2.png) [@jondo2010](https://discourse.paraview.org/u/jondo2010)
#### Post date: [February 20, 2020, 2:03pm UTC](https://discourse.paraview.org/t/any-way-to-as-an-siproxy-to-print-its-server-side-vtk-object/3614/3 "2020-02-20T14:03:29Z")

</div>

Hmm, this doesn’t seem to work. vtkObjectBase::Print(…) needs a parameter, doesn’t it?

Also, if this did work, it would call print on the SMProxy, not on the SIProxy-wrapped vtkObject?

---

<div class="post-metadata">

### Author: ![jondo2010](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jondo2010/32/2840_2.png) [@jondo2010](https://discourse.paraview.org/u/jondo2010)
#### Post date: [February 20, 2020, 2:13pm UTC](https://discourse.paraview.org/t/any-way-to-as-an-siproxy-to-print-its-server-side-vtk-object/3614/4 "2020-02-20T14:13:22Z")

</div>

Hmm actually no, I got confused, this should in theory work.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [February 20, 2020, 2:26pm UTC](https://discourse.paraview.org/t/any-way-to-as-an-siproxy-to-print-its-server-side-vtk-object/3614/5 "2020-02-20T14:26:15Z")

</div>

Seems like `vtkClientServerStream` wrapping has specially handled `Print` to return the result as reply.

```auto
// from vtkObjectBaseClientServer.cxx
if (!strcmp("Print",method) && msg.GetNumberOfArguments(0) == 2)                 
{                                                                                 
  std::ostringstream buf_with_warning_C4701;                                        
  op->Print(buf_with_warning_C4701);                                                
  resultStream.Reset();                                                             
  resultStream << vtkClientServerStream::Reply                                      
    << buf_with_warning_C4701.str().c_str()                              
    << vtkClientServerStream::End;                                       
  return 1;                                                                         
} `

```

Not entirely sure why that was done.

A workaround is to add a new method to your vtkObject subclass that simply calls `Print` and expose that one instead in the XML.
