CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   ParaView (http://www.cfd-online.com/Forums/paraview/)
-   -   NameError: name 'LegacyVTKReader' is not defined (http://www.cfd-online.com/Forums/paraview/124046-nameerror-name-legacyvtkreader-not-defined.html)

Eloise September 26, 2013 08:54

NameError: name 'LegacyVTKReader' is not defined
 
Hello,

I'm trying to run a very simple python script with Paraview 4.0.1 64 bit and I get the error message
NameError: name 'LegacyVTKReader' is not defined

The script is :
Code:

try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

solid_vtk = LegacyVTKReader( FileNames=['D:\\PostProcessing\\solid.vtk'] )
Render()

To run it, I open the Python shell in Paraview and press "Run Script" button.

Can someone test it? Maybe I'm not importing the paraview commands properly? Any advice is welcome :)

Also: If I type solid_vtk = LegacyVTKReader( FileNames=['D:\\PostProcessing\\solid.vtk'] ) in the python shell, it works... But I'd like to use a rather complex script which I can't type in the shell....

Elo´se

wyldckat September 28, 2013 12:24

Hi Elo´se,

Unfortunately not all macros generated by the Trace feature in ParaView will work out-of-the-box. Try this script instead:
Code:

from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

solid_vtk = LegacyVTKReader( FileNames=['D:\\PostProcessing\\solid.vtk'] )
Render()

Although... it's weird... because at first it didn't work as well, but after a couple of tries with the original code, it works fine. Perhaps it has a few issues with expecting that the base Python code to be already in memory!?

Best regards,
Bruno


All times are GMT -4. The time now is 20:01.