ipython env

Fernando Perez fperez.net at gmail.com
Thu Apr 5 22:32:49 EDT 2007


Larry Bates wrote:

> Greg Donald wrote:
>> Anyone know what's up with environment variables when using ipython?
[...]

> In Cpython you get this with:
> 
> import os
> os.environ['EDITOR']

Yup, same in ipython :)  Just to clarify, env is just a convenience function
in ipython that simply does this:

In [4]: env??
Type:           Magic function
Base Class:     <type 'instancemethod'>
String Form:    <bound method InteractiveShell.magic_env of
<IPython.iplib.InteractiveShell object at 0x402046ec>>
Namespace:      IPython internal
File:           /home/fperez/usr/lib/python2.4/site-packages/IPython/Magic.py
Definition:     env(self, parameter_s='')
Source:
    def magic_env(self, parameter_s=''):
        """List environment variables."""

        return os.environ.data


Cheers,

f




More information about the Python-list mailing list