473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ipython env

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,
--
Greg Donald
http://destiney.com/
Apr 5 '07 #1
2 2342
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
Apr 5 '07 #2
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

Apr 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Yaroslav Bulatov | last post by:
> Hi, > > Equis Uno wrote: > > > I use meta-x shell to start a shell and then once I see a shell > > prompt I enter the python command and I get a well-behaved python > > shell inside of emacs....
3
by: Dave Merrill | last post by:
Hi, I'm new to python, and ipython, but not to programming, having trouble getting ipython installed on windows 2000, python 233. Any help would be much appreciated; I'm sure I'm being some basic...
1
by: Jeremy Jones | last post by:
I've written an article on IPython which is now live on O'Reilly's ONLamp site at http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html. All feedback is welcome. Regardless of what you may...
1
by: Michael Tobis | last post by:
It appears that doctest does not work straightforwardly within iPython. I would like to be able to use doctest within a file conditionally, so that I can develop it within ipython and test it...
0
by: Fernando Perez | last post by:
Hi all, The IPython team is happy to release version 0.7.2, with a lot of new enhancements, as well as many bug fixes. We hope you all enjoy it, and please report any problems as usual. ...
0
by: James Stroud | last post by:
Hello, I found this page: http://projects.scipy.org/ipython/ipython/wiki/CookBook#Usinggviminservermode But it does not seem to work for me. I set the editor in ipythonrc to gvim. Then I...
5
by: Lou Pecora | last post by:
I installed the SciPy superpackage and have pylab, matplotlib, scipy, and numpy apparently running well. But I want to use matplotlib/pylab interactively. The instructions suggest doing this in...
0
by: Ville Vainio | last post by:
Hi all, The IPython team is happy to release version 0.7.3, with a lot of new enhancements, as well as many bug fixes (including full Python 2.5 support). We hope you all enjoy it, and please...
1
by: Karlo Lozovina | last post by:
Based on the idea from 'Open Command Window Here' utility from MS - add a context menu item, which allows you to open IPython in selected directory. ---cut-here--- Windows Registry Editor...
0
by: Michele Simionato | last post by:
This should probably go to the IPython list, but since I am not subscribed I will try my luck here. Basically, I want to embed IPython inside a command line interpreter based on cmd.Cmd, in this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.