J
jshrager
I have some rather complex code that works perfectly well if I paste it in by hand to ipython, but if I use %run it can't find some of the libraries, but others it can. The confusion seems to have to do with mathplotlib. I get it in stream by:
%pylab osx
and do a bunch of stuff interactively that works just fine, for example:
clf()
But I want it to run on a %run, but %pylab is (apparently) not allowed froma %run script, and importing matplotlib explicitly doesn't work...I mean, it imports, but then clf() is only defined in the module, not interactively..
More confusing, if I do all the setup interactively, and the try to just run my script, again, clf() [etc] don't work (don't appear to exist), even though I can do them interactively.
There seems to be some sort of scoping problem ... or, put more correctly, my problem is that I don't seem to understand the scoping, like, are %run eval'ed in some closed context that doesn't work the same way as ipython interactive? Is there any way to really do what I mean, which is: Please just read in commands from that script (short of getting out and passing my script through stdin to ipython?)
Thanks!
%pylab osx
and do a bunch of stuff interactively that works just fine, for example:
clf()
But I want it to run on a %run, but %pylab is (apparently) not allowed froma %run script, and importing matplotlib explicitly doesn't work...I mean, it imports, but then clf() is only defined in the module, not interactively..
More confusing, if I do all the setup interactively, and the try to just run my script, again, clf() [etc] don't work (don't appear to exist), even though I can do them interactively.
There seems to be some sort of scoping problem ... or, put more correctly, my problem is that I don't seem to understand the scoping, like, are %run eval'ed in some closed context that doesn't work the same way as ipython interactive? Is there any way to really do what I mean, which is: Please just read in commands from that script (short of getting out and passing my script through stdin to ipython?)
Thanks!