Is there a way to know at runtime if a Python file is executed from the ParaView environment (pvpython, pvbatch or from the Python shell of the GUI) or from a standard Python interpreter? I checked the environment variables with
$ pvpython
>>> import os
>>> from pprint import pprint
>>> pprint(os.environ._data)
but did not find anything that would indicate that.
__name__ allows us to differentiate between batch mode and PV GUI mode, but even if __name__ == '__main__', the script could be executed from pvpython/pvbatch and from a standard Python interpreter. This latter is what I would like to know. I edited the post.