Hi, I solved it. It had nothing to do about Paraview but about my little experience on python scripting. I used argument parsing and called 'sys.exit()' when a wrong parameter was introduced, and that was my problem. Now everything works fine.
Thank you again Sebastien, Dani. 2013/8/5 Sebastien Jourdain <[email protected]> > Not sure to follow... > > If you are running your script in pvpython why would you need an exit() > call ? > > When I create the following file: > > === test.py ==== > > from paraview.simple import * > Cone() > Show() > Render() > > and run $ pvpython test.py > > The application run and exit just fine... > > > On Mon, Aug 5, 2013 at 8:51 AM, Dani Mora <[email protected]>wrote: > >> Hi again everyone, >> >> I realized that I have an extra problem after importing paraview.simple. >> Everytime I import it in python/pvpython, it hangs after the 'exit()' >> command. >> >> I also created a module that includes this funcionality. When a python >> file uses my module, it hangs also at the end of the script. >> >> Everything works perfectly, but It seemes that there is something wrong >> with this module when finishing scripts. I have even tried with a one-line >> script containing just: "from paraview.simple import *" and it hangs too. >> >> Any idea about this? I am using Windows 7 and Paraview 4.0.1. I tried >> with Paraview 3.9 and doesn't work either. >> >> Thank you, >> >> Daniel. >> >> 2013/8/2 Sebastien Jourdain <[email protected]> >> >>> Thanks Daniel for sharing your full script. >>> >>> >>> On Fri, Aug 2, 2013 at 8:14 AM, Dani Mora >>> <[email protected]>wrote: >>> >>>> Hi again Sebastien, >>>> >>>> Thanks for your answer. I attach the code I am going to use in case >>>> someone finds it useful and I will also appreciate suggestions about how to >>>> improve it: >>>> >>>> >>>> from paraview.simple import * >>>> from paraview.vtk import * >>>> from vtkPVClientServerCoreRenderingPython import * >>>> from vtkPVVTKExtensionsWebGLExporterPython import * >>>> >>>> vtkreader = LegacyVTKReader() >>>> vtkreader.FileNames = "model.vtk" >>>> >>>> dp = Show(vtkreader) >>>> dp.Representation = 'Points' >>>> >>>> elev = Elevation(vtkreader) >>>> pData = elev.PointData[2] >>>> range = pData.GetRange() >>>> >>>> dp.LookupTable = MakeBlueToRedLT(range[0],range[1]) >>>> dp.ColorArrayName = "Pressure" >>>> >>>> renderView = GetRenderView() >>>> # Gradient background >>>> renderView.Background = [0.06274509803921569, 0.06666666666666667, >>>> 0.06274509803921569] >>>> renderView.Background2 = [0.4745098039215686, 0.47058823529411764, >>>> 0.4745098039215686] >>>> # Object axis invisible >>>> renderView.CenterAxesVisibility = 0 >>>> >>>> # Export to HTML >>>> >>>> view = Render().GetClientSideObject() >>>> exporter = vtkPVWebGLExporter() >>>> exporter.SetFileName("C:\\ba.html") >>>> >>>> exporter.SetRenderWindow(view.GetRenderWindow()) >>>> exporter.Update() >>>> >>>> Thanks a lot for your help. >>>> >>>> Daniel. >>>> >>>> 2013/8/1 Sebastien Jourdain <[email protected]> >>>> >>>>> Hi Daniel, >>>>> >>>>> I thought that VTK would contain the WebGL exporter which it doesn't >>>>> (for now). So you are stuck with pvpython for now. >>>>> >>>>> Here is a pvpython script >>>>> >>>>> >>> from paraview.simple import * >>>>> >>>>> >>> from paraview.vtk import * >>>>> >>>>> >>> from vtkPVClientServerCoreRenderingPython import * >>>>> >>>>> >>> from vtkPVVTKExtensionsWebGLExporterPython import * >>>>> >>>>> >>>>> >>> Cone() >>>>> >>> Show() >>>>> >>> view = Render().GetClientSideObject() >>>>> >>>>> >>> exporter = vtkPVWebGLExporter() >>>>> >>>>> >>> exporter.SetFileName("/tmp/index.html") >>>>> >>>>> >>> exporter.SetRenderWindow(view.GetRenderWindow()) >>>>> >>>>> >>> exporter.Update() >>>>> >>>>> >>>>> >>>>> >>>>> On Tue, Jul 30, 2013 at 8:04 AM, Dani Mora < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi Sebastien, >>>>>> >>>>>> Thanks for your answer. I tried to use the trace but it seems that it >>>>>> does not track the exporting process. I also downloaded and compiled the >>>>>> vtk kit and I could not find the vtkpython module. >>>>>> >>>>>> Dani. >>>>>> >>>>>> >>>>>> 2013/7/24 Sebastien Jourdain <[email protected]> >>>>>> >>>>>>> 1) pvserver is not a web server. It is meant to run on a cluster for >>>>>>> very large visualization. Which is definitely not what you are looking >>>>>>> for. >>>>>>> >>>>>>> 2) The html page is the only file needed for you. The other files >>>>>>> were used for development of custom web page when streaming could be >>>>>>> involved. >>>>>>> >>>>>>> Regarding your question about the scripting part, it is definitely >>>>>>> doable but I don't know the step on the top of my head. >>>>>>> >>>>>>> You can try to use the trace and see if that give you the proper >>>>>>> python command for pvpython. Otherwise, you should be able to use >>>>>>> vtkpython >>>>>>> without ParaView. >>>>>>> >>>>>>> Seb >>>>>>> >>>>>>> >>>>>>> On Wed, Jul 24, 2013 at 4:24 AM, Dani Mora < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Hello everybody, >>>>>>>> >>>>>>>> I just started to use Paraview and I got a bit stuck. We have some >>>>>>>> JSP pages where we want to embed and visualize some .vtk models. I >>>>>>>> considered two options at first: >>>>>>>> >>>>>>>> 1- Deploy a server that will render the models. I tried to do that >>>>>>>> but I found that I should compile again Paraview to start the pvserver >>>>>>>> (to >>>>>>>> enable the MPI). I followed the steps here: >>>>>>>> http://paraview.org/Wiki/ParaView:Build_And_Install but I got some >>>>>>>> compiler errors that I have not been to solve. >>>>>>>> >>>>>>>> 2- Export the .vtk models into webgl (using the Paraview GUI) and >>>>>>>> embed the resulting .html documents as JSP pages . This is the simple >>>>>>>> approach and works so far. Regarding this option, I have two questions: >>>>>>>> >>>>>>>> - When exporting from vtk to webgl, we get one HTML file, one >>>>>>>> WebGL file and around 20 tiny files with unknown information. Since it >>>>>>>> works using only the HTML one, what are the rest of the files for? >>>>>>>> >>>>>>>> - I need this task (to export) to be automatized because it is >>>>>>>> possible that we will have many models in the future. I tried to use >>>>>>>> Python >>>>>>>> scripting but I could not find how to do it. Any idea about how to do >>>>>>>> it? Is there any documentation I could read? I was thinking of >>>>>>>> extracting >>>>>>>> this functionality from the source code but I am looking for a >>>>>>>> 'smarter' >>>>>>>> solution. >>>>>>>> >>>>>>>> Thanks a lot in advance, and sorry if some of the questions are >>>>>>>> very basic. >>>>>>>> >>>>>>>> Daniel. >>>>>>>> >>>>>>>> PS: I am working under Windows as a constraint of the project. >>>>>>>> PS2: I recently found the X Toolkit WebGL ( >>>>>>>> https://github.com/xtk/X#readme) that is currently working, but I >>>>>>>> would like to have other options anyway. >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Powered by www.kitware.com >>>>>>>> >>>>>>>> Visit other Kitware open-source projects at >>>>>>>> http://www.kitware.com/opensource/opensource.html >>>>>>>> >>>>>>>> Please keep messages on-topic and check the ParaView Wiki at: >>>>>>>> http://paraview.org/Wiki/ParaView >>>>>>>> >>>>>>>> Follow this link to subscribe/unsubscribe: >>>>>>>> http://www.paraview.org/mailman/listinfo/paraview >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
