How do I use Liclipse to write a ParaView script?

℡╲_俬逩灬. 提交于 2019-12-12 00:05:04

问题


I've tried following the directions here without success. Here are some of my environment variables:

Path: C:\Python34\;C:\Python34\Scripts;...;C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages;C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages\vtk

PYTHONPATH: C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages;C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages\vtk;C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3

If I'm in Liclipse and I type c = Cone() it gets underlined in red and I get an "Undefined Variable" message, whether I have from paraview.simple import * at the top or not. I can, however, type things like paraview.simple.GetActiveSource() and paraview.simple.demo1() without seeing this problem if I've imported paraview.simple. But then, if I try to run the code from a command prompt, I get a message that says:

File "C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages\paraview\vtk__init__.py", line 7, in module

from vtkCommonCorePython import *

ImportError: DLL load failed: The specified module could not be found.

If I write from paraview.simple import * in an IDLE 2.7.8 window, I get the same error. If I use my IDLE 3.4.3 window, I get a syntax error.

The only success that I've had is with writing some code that appears to have errors, and then either loading it as a macro within ParaView or pressing the "Run Script" button from ParaView's Python shell.


Edit: I just tried reinstalling Python 2, thinking that maybe ParaView only works with Python 2? This changed my environment variables a little:

Path: C:\Python27\;C:\Python27\Scripts;C:\Python34\;C:\Python34\Scripts;...;C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages;C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages\vtk

Now, the error has changed to this:

File "C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages\paraview\vtk__init__.py", line 7, in module

from vtkCommonCorePython import *

ImportError: DLL load failed: %1 is not a valid Win32 application.


Edit: Now that the problem has been resolved, I thought I should share my path variables.

Path: C:\Python27\;C:\Python27\Scripts;...;C:\Program Files (x86)\ParaView 4.3.1\bin

PYTHONPATH: C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages;C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site-packages\vtk


回答1:


Yes, you need to work with python 2 (64bit). Make sure you are adding to the path the folder with the *.pyd and *.dll (I think it's a folder called bin)



来源:https://stackoverflow.com/questions/31883557/how-do-i-use-liclipse-to-write-a-paraview-script

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