[Numpy-discussion] cos -- NameError: global name 'cos' is not defined
Mon Dec 21 22:21:07 CST 2009
On Mon, Dec 21, 2009 at 8:25 PM, Wayne Watson
> I may have inadvertently made a slip between using script versus shell.
> What I'm getting at it that the namespace is the same for both the
> editor window and shell window. I find that a little bizarre. I would
> have expected each Run from the editor to clear all modules, and only
> load those shown in the editor.
> NumPy-Discussion mailing list
I'm not really sure what you mean with "What I'm getting at it that
the namespace is the same for both the
editor window and shell window"
I'm also on WindowsXP, I'm using the subprocess (-n) option of IDLE in
the following way:
starting on the command line with -n as in
>"C:\Programs\Python25\pythonw.exe" "C:\Programs\Python25\Lib\idlelib\idle.pyw" -n
which I think is the default in the programs shortcut, only uses one
process for interpreter shell and idle and reload is not possible.
When I start IDLE with
then the interpreter is run in a separate process. Whenever I hit F5
then it restarts the process with just the script in the editor. Idle
in this case also has an option to "Restart Shell" under the Shell
menu. In this case there are no spill-overs from one run to the next,
and you only get what is in the script.
To make my life easier, I associated two (actually I have 4 - same for
python 2.4 and 2.5) different ways of starting a .py file when I right
click a file in windows explorer. I changed/added the file association
in file types in the tools-folder options menu of windows explorer,
corresponding to the two options
"C:\Programs\Python25\Lib\idlelib\idle.pyw" -n -e "%1"
"C:\Programs\Python25\Lib\idlelib\idle.pyw" -e "%1"
when I'm just experimenting with a script, I choose option with -n to
avoid long import times. When I need to make sure that all
dependencies/imports are reloaded, I start without -n. However, it is
only possible to have one interpreter with -n open at one time (and
right now I have 9 separate python idle running, one of them without
But actually, I'm using Spyder now most of the time, which let's you
choose at runtime, whether to run a script in a separate process
(external shell), in the same process as spyder and the interactive
interpreter (internal shell), or to execute just a few selected lines
(as F9 in matlab, I think) in the interpreter (also in internal
shell). Except for a few editor quirks, Spyder works very well.
Note: all editors when they run shell and editor in the same process
have some background noise (or magic). But with separate subprocesses
or external shells that allow restart, you loose some of the
More information about the NumPy-Discussion