I'd like to use a driver Python script to call a Python function within a module that uses ParaView to read a file in parallel and I was wondering the best way to go about this.
A little background: The file structure is something like this: mypythonpackage/ scripts/ my_driver_script.py mypythonpackage/ paraview/ filewithparaviewstuff.py utilities.py The driver script takes inputs and then calls a function in filewithparaviewstuff.py that uses ParaView to load a large data file and do some data analysis. I need to load the dataset in parallel since it is quite large. To get around this in the past I've used two different methods: 1. Use the subprocess Python package inside the my_driver_script.py to call the filewithparaviewstuff.py using pvbatch. 2. Use the subprocess Python package inside the my_driver_script.py to start a pvserver and then connect to this server within the function inside filewithparaviewstuff.py The issue I have is the filewithparaviewstuff.py calls some functions in the utilities.py file. I'm trying to follow PEP 328 <https://www.python.org/dev/peps/pep-0328/> and use import statements within filewithparaviewstuff.py like: from .utilities import my_utility_function inside the filewithparaviewstuff.py but this causes problems <http://stackoverflow.com/questions/11536764/attempted-relative-import-in-non-package-even-with-init-py> if I use method 1, of calling the filewithparaviewstuff.py directly with pvbatch or if I try to make a '__main__' function in the filewithparaviewstuff.py and call that directly with pvbatch. Am I doing something fundamentally wrong or has anyone encountered this situation and come up with a more elegant solution? If not, should I just keep going with my option 2? Thanks, Andy
_______________________________________________ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview