473,289 Members | 1,791 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,289 software developers and data experts.

RE: How to get all the variables in a python shell

Lee
Hi, thank your for your reply. I will try iPython.

I did try sage for a while, but I found it quite heavy, and I'm not sure
whether it's easy to expand like python or not. New libraries can be
easily imported in python, and those libraries could be build in almost
any popular computer
language. Can sage do that?

The reason why I want to work on this is the same with you. I'm an
automotive engineer. What I need is a powerful
yet light-weight computation software, which can help me in analyzing
datas on the engine test bench. Matlab is powerful, but it contains so
much stuff that I actually don't need but have to buy, and you know that

it's quite expansive.

So my idea is to build a GUI with python first, and then intergrate as
many exsiting computation libraries as possible. There also has to be a
plotting app, which is quite important and need to think about. I did
try Gnuplot-python combination and matplotlib, but found both terrible
inferior to Matlab plotting functionality. Do you know any plotting
programs written in
python?
-----Original Message-----
From: py**************************************@python.or g
[mailto:py**************************************@py thon.org] On Behalf
Of ca**@mailinator.com
Sent: Friday, May 30, 2008 9:55 PM
To: py*********@python.org
Subject: Re: How to get all the variables in a python shell
Your project interests me. Actually I was thinking about doing the
same. I hadn't worked on it at all, but I though about it and had the
idea about reading the session namespace directly, which I though would
be stored in the __dict__ attribute of something.

After reading your post, I have been trying a little bit, and I have
found a way to do it with ipython. If you open an ipython console, press
_ then hit TAB, you'll see it stores some useful information, including
all input, all output, and after some searching, a dictionary matching
all variables to its values.

__IPYTHON__.user_ns

There is a little extra stuff in there that you don't want, but that
can be easily filtered (the extra stuff is either 'In', 'Out', 'help' or
starts with '_'). I've tried it, and you can change the value in that
dict to alter the value of the real variable. Say you have a variable
'test':

test=5
__IPYTHON__.user_ns['test']=4
print test #prints 5

If I get it right, python is a dynamic language, and you won't break
things by messing around with its inner stuff like this, but you better
check it.

Is this what you had in mind?
--
http://mail.python.org/mailman/listinfo/python-list

Jun 27 '08 #1
1 1111

Have you seen this page?
http://matplotlib.sourceforge.net/screenshots.html
On watching this, I wouldn't say matplotlib is inferior to matlab
plotting. Also, I don't know what they use in sage, but they have 3D
plots of surfaces that you can rotate with the mouse.
Do as you like, but if you want to "intergrate as many exsiting
computation libraries as possible" you may end up doing something too
similar to sage. I wouldn't want to go on such a trip alone, so even
if sage is not exactly what I would do, I will probably work with
them. Their client-server approach should make it easy to work on a
cool interface without messing too much with their code. It's true,
you'll have to carry with you a lot of symbolic computation tools that
may be you don't need as an engineer, but is it that important? The
client-server approach has other advantages: if you have a very
lightweight computer (like EEE), you can place the server at home and
the lightweight computer is enough to have a full scientific
environment outdoors. And yes, I'm pretty sure you can call any
library from within sage the same way you'd do it from python.
Regards
Pablo
Jun 27 '08 #2

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

Similar topics

4
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or...
20
by: Matthew Thorley | last post by:
My friend sent me an email asking this: > I'm attemtping to decide which scripting language I should master and > was wondering if it's possible to do > these unixy awkish commands in python:...
3
by: Greg Lindstrom | last post by:
Hello- I am running python 2.3. on an HP-9000 box running Unix and have a POSIX script that sets up my production environment. I would like to run the script from inside a python routine and...
3
by: David Durkee | last post by:
Hi, I'm trying to write a script I can run from tcsh in Terminal (on Mac OS X) that will set environment variables that can be accessed by subsequent commands I execute in that session. Not...
2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
30
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic nuts-and-bolts of how I work in these languages, and ask for...
5
by: Maxim Veksler | last post by:
Hello list, I'm trying to write a python script that would allow me to manipulate shell variables of the calling shell. I'm trying to write some logic that would know to add LD_LIBRARY_PATH to...
15
by: lixinyi.23 | last post by:
Hi! I'm currently working on a scientific computation software built in python. What I want to implement is a Matlab style command window <-> workspace interaction. For example, you type...
1
by: Fredrik Lundh | last post by:
John Lawrence wrote: doesn't exactly work for Python scripts, though: $ cat env.py #!/usr/bin/env python import os os.environ = "hello"
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.