[IPython-User] Can't display image from external script
Fri Jan 24 04:16:51 CST 2014
A few comment inline.
Le 24 janv. 2014 à 10:25, Arnaud Mounier a écrit :
> Hi everyone,
> ipython notebook --pylab inline
Try not to start notebook with --pylab flag,
On IPython !.0 and above prefer the use of %matplotlib inline to have the figure inline,
on rely on explicit import (even import *), otherwise --pylab will bite you at a later point.
Also the flag will deprecate at some point, so your notebook might not work anymore.
> The script "see" correctly the image but function Image don't succeed to
> display and don't genrate an error.
> Any Idea where I do wrong ?
> def main(argv=None):
> if __name__ == "__main__":
Well, this is the expected behavior, you are just making the same misinterpretation of what Image() does than any other beginner.
in short the difference between Image() and display image is the same than between
In : 1
Out: 1 ## got an out prompt
In : print 1
1 ## got no out prompt
So Image() **does not** display an image, it does create a Image object.
showing an image (or any over object) is done by calling IPython.display.display(object)
It just happened that the last execution block of each cell has display called on it's returned value,
hence when Image is the last thing of a cell, it will display (well actually not exactly but it's not the point here)
So in your example, as %run return nothing, nothing is show.
Does it make sense ?
does it work with display(Image(…)) ?
More information about the IPython-User