Hi Pat, Thank you for your quick response.
Yes setting the __file__ variable would be great. Is there a formal way to do a feature request? From googling, I see people have just posted requests to this list. Is that good enough? If so, could we please have this has a feature request? If it is worth your time, perhaps you could point me to were I should start looking and perhaps I might be able to figure out how to implement the feature myself. Thank you Matt Wilkins On Wed, Jun 09, 2010 at 10:46:23PM -0400, pat marion wrote: > 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, <[email protected]> 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 > > _______________________________________________ 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
