473,586 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.framewor k/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.Name Error 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 2351
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.framewor k/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.Name Error 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 InteractiveShel l.magic_env of
<IPython.iplib. InteractiveShel l 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
2643
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. > > > > I'm trying to figure out the best way to run ipython inside of emacs.
3
1556
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 flavor of dense... First downloaded and installed PythonWin, readline and ctypes. They're all pretty clearly here and working, because I can run...
1
1711
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 think of the article, I hope it encourages everyone to at least try out IPython. IPython has become an indispensible tool in my toolbox. I cannot...
1
1943
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 otherwise. It would seem that this would work: Python 2.4.1 (#2, Mar 31 2005, 00:05:10) on darwin
0
1278
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. WHAT is IPython? ----------------
0
1402
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 followed the instructions, step by step. To needlessly paraphrase the instructions:
5
3277
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 IPython. But using ipython on the command line gives me an error. The system doesn't know the command. Apparently there is no ipython executable...
0
1056
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 report any problems as usual. WHAT is IPython?
1
4818
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 Version 5.00 @="IPython here"
0
933
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 way: import cmd, IPython class Cmd(cmd.Cmd): def do_ipython(self, arg):
0
8204
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.