ipython env
Larry Bates
larry.bates at websafe.com
Thu Apr 5 18:03:17 EDT 2007
Greg Donald wrote:
> Anyone know what's up with environment variables when using ipython?
>
> When I type 'env' and hit return I get a dictionary full of useful
> information (trimmed for brevity):
>
> In [1]: env
> Out[1]:
> {'EDITOR': '/usr/bin/vim',
> [...]
> '_': '/Library/Frameworks/Python.framework/Versions/Current/bin/ipython',
> '__CF_USER_TEXT_ENCODING': '0x1F5:0:0'}
>
>
> But then when try to access the information in the dictionary it
> doesn't seem to exist:
>
> In [2]: env['EDITOR']
> ---------------------------------------------------------------------------
> exceptions.NameError Traceback (most
> recent call last)
>
> /Users/destiney/<ipython console>
>
> NameError: name 'env' is not defined
>
>
> Thanks,
>
>
In Cpython you get this with:
import os
os.environ['EDITOR']
-Larry
More information about the Python-list
mailing list