How to run a paraview Python code using pvbatch or pv python

纵然是瞬间 提交于 2019-12-11 20:14:48

问题


I am trying to run this Python file using pvpython [filename].py

from paraview.simple import *
servermanager.Connect()
#sphere = Sphere();
#Show();

import os
i = 0
SubDir = [" "]*30
# Set the directory you want to start from
rootDir = '/var/www/html/php/emd/job552e23fe74d102/VTK'
for dirName, subdirList, fileList in os.walk(rootDir):
    if dirName == rootDir + '/others':
       continue
    if dirName == rootDir:
       continue
    SubDir.append(dirName)
    i=i+1
    print('Found directory: %s' % dirName)
    for fname in fileList:
        print('\t%s' % fname)
        j=1
        j= LegacyVTKReader( FileNames=[dirName + '/' + fname] )

and I am getting this error

File "paraview.py", line 2, in <module>
    from paraview.simple import *
File "/var/www/html/php/emd/job552e23fe74d102/VTK/paraview.py", line 2, in <module>
    from paraview.simple import *
ImportError: No module named simple

Is there anywhere I have gone wrong. Please help me, I am a beginner in this.


回答1:


This happens to me if I do not add the directory that holds the ParaView Libraries to the LD_LIBRARY_PATH system variable. I have ParaView 4.0.1 installed as an example and I append the path to the variable as follows in Ubuntu:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/sgeadmin/ParaView-4.0.1-Linux-64bit/lib/paraview-4.0



来源:https://stackoverflow.com/questions/29923266/how-to-run-a-paraview-python-code-using-pvbatch-or-pv-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!