[Paraview] Python shell, os.environ

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Dec 20 21:16:20 EST 2017


Randy,

No, `os` hasn't been hijacked by PV.  Here's what I get on Linux.

./bin/pvpython
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ["FOO"]
'12'


I suspect it's something to do with App bundles on macOS and what
environment variables they see based on how you launch them. I can't
remember that of the top of my head, but that's where I'd start
looking.

Utkarsh


On Wed, Dec 20, 2017 at 5:50 PM, Heiland, Randy <heiland at iu.edu> 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.
>
>
>> On Dec 20, 2017, at 4:30 PM, Heiland, Randy <heiland at iu.edu> wrote:
>>
>> I noticed the Python shell has a very limited os.environ, e.g.:
>>>>> os.environ
>> {'SHELL': '/bin/bash', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.y86uYmHWFV/Listeners', 'XPC_FLAGS': '0x0', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0', 'Apple_PubSub_Socket_Render': '/private/tmp/com.apple.launchd.CM4C6EMoE6/Render', 'LOGNAME': 'heiland', 'USER': 'heiland', 'XPC_SERVICE_NAME': 'org.paraview.ParaView.33336', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'HOME': '/Users/heiland', 'DISPLAY': '/private/tmp/com.apple.launchd.4ORv1l0yeN/org.macosforge.xquartz:0', 'TMPDIR': '/var/folders/l6/s467rzgs75n91gdbkn7vr0f40000gn/T/'}
>>>>>
>>
>> I’m guessing this is a security measure? Anyway, is there any way one can use an env var to pass in desirable info to PV’s Python, e.g., a dir path to data to be read by a Programmable Source? Or perhaps there’s some other entirely different way to do this?
>>
>> thanks, Randy
>> _______________________________________________
>> 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:
>> https://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
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> https://paraview.org/mailman/listinfo/paraview


More information about the ParaView mailing list