Bill,
This doesn't answer your question but instead provides an alternative. You can save the state as a python script. Since the point is to recreate the state within a pvpython, this might be a more natural way to do it anyway. The Python script should be straightforward to edit to use variables for filenames instead of constants. -Ken On 5/20/14 12:18 PM, "Bill Sherman" <[email protected]> wrote: >Greetings all, > >A question on how one can use ParaView state files in a scripting mode, >where the file directory is different. To be specific, I'm creating a >state file using the ParaView GUI client (version 4.0.1), and I then save >the state, and then in pvpython I can load the state and write out an >animation. This works fine as long as I'm on the same machine, or at >least have the same directory name containing the data files. > >My goal, however, is to now run those animation scripts on a Cray, where >my directory structure is different. > >So first a disclaimer -- I figured out how to do this by doing a >mass-substitution >in vim, setting all the filenames to begin with "./" instead of the full >path, and then running pvpython in the directory with the data. This >works. > >But, I'd prefer a cleaner/more-elegant means of doing this, and so I come >to this well of information. > >First question: is there a way to prevent "pvpython" from loading data >files when then state is read? Otherwise I get a slew of errors when >it discovers that the files don't exist. Somehow the ParaView GUI Client >must do this, because it will provide a popup asking for a new directory >in which to find the missing files. > >Second question: ignoring the error messages, I still can't manage to >change the file names and have pvpython use the new names -- so question >is: what am I doing wrong? > >Here's the basics of what I've tried: > > >>> from paraview.simple import * > >>> servermanager.LoadState("testC.pvsm") > >>> olddir = "/directory-in-state-file" > >>> newdir = "/cray-directory-with-data" > >>> reader = FindSource("jhdata_*") > >>> for num in range(0, len(reader.FileNames)): >... reader.FileNames[num] = reader.FileNames[num].replace(olddir, >newdir) > >I can then print all the filenames, and they appear to have been changed. >But I can't seem to get the servermanager to recognize this. I tried: > > >>> reader.FileNameChanged() > >>> UpdatePipelineInformation() > >this returns the error: > >--------- >ERROR: In >/N/soft/cle4/paraview/ParaView-v4.0.1-source/VTK/IO/Parallel/vtkPDataSetRe >ader.cxx, >line 880 >vtkPDataSetReader (0x1fa4d70): Initialize: Could not open file >olddir/jhdata_001.vtk > >ERROR: In >/N/soft/cle4/paraview/ParaView-v4.0.1-source/VTK/Common/ExecutionModel/vtk >Executive.cxx, >line 754 >vtkPVCompositeDataPipeline (0x1f579f0): Algorithm >vtkFileSeriesReader(0x1fbc7b0) returned failure for request: >vtkInformation (0x13c0890) > Debug: Off > Modified Time: 147820 > Reference Count: 1 > Registered Events: (none) > Request: REQUEST_DATA_OBJECT > FORWARD_DIRECTION: 0 > ALGORITHM_AFTER_FORWARD: 1 >---------- > >I then also tried > >>> reader.UpdatePipeline() > >with the same results. If I then tried to call "WriteImage()" or >"WriteAnimation", >it complains and then seg-faults. > > >Once this is all settled, of course I'll transition to "pvbatch" to >queue things up, which I anticipate should work with what I learn >from interacting with "pvpython". > > Thanks! > Bill > >-- >Bill Sherman >Sr. Technology Advisor >Advanced Visualization Lab >Pervasive Technology Inst >Indiana University >[email protected] > > >_______________________________________________ >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
