[Paraview] Python shell, os.environ

Heiland, Randy heiland at iu.edu
Thu Dec 21 10:14:01 EST 2017


> On Dec 21, 2017, at 9:34 AM, Ben Boeckel <ben.boeckel at kitware.com> wrote:
> 
> On Wed, Dec 20, 2017 at 22:50:50 +0000, Heiland, Randy wrote:
>> Ah, I see ‘os’ has been hijacked by PV. But something like this seems
>> to accomplish what I want, maybe…
>> 
>> Create a new module for PV:
>> 
>> /Applications/ParaView-5.4.1.app/Contents/Python$ more envs.py
>> import os
>> os.environ['PHYSICELL_DATA']=‘/fill_in_path’
>> 
>> and then in the PV Python shell, the os.environ will indeed contain
>> this new env var.
> 
> This can't be part of the package though since if it is installed
> globally, users may not have write access to the .app directory.
> 
> It seems the way to do this is along these lines (in short, Apple isn't
> making what you want to do easy):
> 
>    https://superuser.com/questions/476752/setting-environment-variables-in-os-x-for-gui-applications#541068
>    https://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x/32405815#32405815
> 
> There seems to have been something like `~/.launchd.conf` at some point
> and `~/.MacOSX/environment.plist` before that, but those has been
> deprecated and no longer work.
> 
> —Ben

Thanks Ben.  You’re right, of course. Moreover, my idea for having (non-admin) users install additional Python modules (e.g., scipy) into PV’s dir, is a not going to go well.

Do we at least agree that if I ask users to start PV from the Terminal, PV’s Python will then pick up the user’s env vars?

-Randy  (who’s really liking: “Step 1: Become an Admin” :)



More information about the ParaView mailing list