[Paraview] location of python plugin macro

pat marion pat.marion at kitware.com
Wed Jun 9 22:46:23 EDT 2010


I'm afraid there isn't a way to get the name of the python file that is
currently executing.  Paraview reads the contents for the file into a string
and passes the string to the interpreter, so python has no association
between the string and the file.  As a feature request, I think it would be
reasonable to have paraview set the __file__ variable to be the name of the
file before executing it.

Pat

On Wed, Jun 9, 2010 at 5:15 PM, <m.c.wilkins at massey.ac.nz> wrote:

>
> Hi,
>
> I would like to find the location of the currently running python
> plugin macro.  This is so I can do an import of a library that lives
> in a directory relative to the directory where all my paraview plugins
> live.  Is this possible?
>
> In a normal python programme sys.argv[0] can help me, but ofcourse
> that just points to the paraview binary in this case.  os.getcwd() is
> no use.  The info is known to paraview (for instance it is in
> ~/.config/ParaView/ParaView3.8.0.ini file under the [PythonMacros]
> section - but I really don't want to go trolling through that file).
>
> I have quite a few plugins, and I want to do the correct thing by
> breaking some of the shared functionality out into a module.
>
> Thanks for any help
>
> Matt
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100609/f2160fe0/attachment.htm>


More information about the ParaView mailing list