Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55428
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-10-03 10:42 -0700 |
| Message-ID | <fa461da1-19d9-41e5-8af2-de6c73540023@googlegroups.com> (permalink) |
| Subject | ipy %run noob confusion |
| From | jshrager@gmail.com |
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 from a %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!
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
ipy %run noob confusion jshrager@gmail.com - 2013-10-03 10:42 -0700 Re: ipy %run noob confusion Terry Reedy <tjreedy@udel.edu> - 2013-10-03 15:26 -0400 Re: ipy %run noob confusion Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-03 20:34 +0100 Re: ipy %run noob confusion Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-10-04 10:36 +0100 Re: ipy %run noob confusion Jeff Shrager <jshrager@gmail.com> - 2013-10-04 07:16 -0700
csiph-web