[Paraview] Import error with programmable filter

Pat Marion pat.marion at kitware.com
Mon Feb 25 20:10:54 EST 2013


Could you try running this test script with pvpython like this:

$ cat test.py
from paraview.simple import *
f = ProgrammableSource()
f.Script = 'print "something"'
f.UpdatePipeline()


$ /Applications/paraview.app/Contents/bin/pvpython test.py
something

Does that work?

Pat

On Tue, Feb 26, 2013 at 11:02 AM, Colin McAuliffe <cjm2176 at columbia.edu>wrote:

> I can get the path for the main script but not for the programmable filter
> because of the import error.
>
> There is
>
> /Applications/ParaView.app/**Contents/Python
> /Applications/ParaView.app/**Contents/Libraries
> /Applications/ParaView.app/**Contents/bin
>
> in the path for the main script. Is there anything missing?
>
> Quoting Pat Marion <pat.marion at kitware.com>:
>
>  I forgot to cc the mailing list.
>>
>> On Tue, Feb 26, 2013 at 8:42 AM, Pat Marion <pat.marion at kitware.com>
>> wrote:
>>
>>  The programmable filter will run in the same process, using the same
>>> python, as the main script.  But, it's possible something is not working
>>> right with the paths.  I would put a print statement in both the main
>>> script and in the programmable filter's script to "import sys; print
>>> sys.path" and make sure that in both cases the correct paths are being
>>> used.  At least one entry in the path should list the folder that
>>> contains
>>> the paraview python module directory  (the paraview directory that
>>> contains
>>> __init__.py).
>>>
>>> Pat
>>>
>>>
>>> On Tue, Feb 26, 2013 at 3:08 AM, Colin McAuliffe  <cjm2176 at columbia.edu
>>> >wrote:
>>>
>>>  Hello all,
>>>>
>>>> I am trying to use the programmable filter in a python script, but it is
>>>> not able to find the paraview module.
>>>>
>>>> the code:
>>>>
>>>> ProgrammableFilter1 = ProgrammableFilter()
>>>>
>>>> ProgrammableFilter1.Script = 'print "something"'
>>>>
>>>> Show()
>>>>
>>>>
>>>> gives the error:
>>>>
>>>> Traceback (most recent call last):
>>>>   File "<string>", line 1, in <module>
>>>> ImportError: No module named paraview
>>>>
>>>> since I run all my scripts with pvpython, the path should be set up
>>>> properly, but I am wondering if ProgrammableFilter is invoking a
>>>> different
>>>> version of python?
>>>>
>>>> Thanks
>>>> Colin
>>>>
>>>>
>>>> --
>>>> Colin McAuliffe
>>>> PhD Candidate
>>>> Columbia University
>>>> Department of Civil Engineering and Engineering Mechanics
>>>> ______________________________****_________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at http://www.kitware.com/**
>>>> opensource/opensource.html<htt**p://www.kitware.com/**
>>>> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>>>> >
>>>>
>>>>
>>>> Please keep messages on-topic and check the ParaView Wiki at:
>>>> http://paraview.org/Wiki/****ParaView<http://paraview.org/Wiki/**ParaView><
>>>> http://paraview.org/Wiki/**ParaView <http://paraview.org/Wiki/ParaView>
>>>> >
>>>>
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.paraview.org/****mailman/listinfo/paraview<http://www.paraview.org/**mailman/listinfo/paraview>
>>>> <http**://www.paraview.org/mailman/**listinfo/paraview<http://www.paraview.org/mailman/listinfo/paraview>
>>>> >
>>>>
>>>>
>>>
>>>
>>
>
>
> --
> Colin McAuliffe
> PhD Candidate
> Columbia University
> Department of Civil Engineering and Engineering Mechanics
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130226/71d33669/attachment.htm>


More information about the ParaView mailing list