[IPython-User] Can't display image from external script

Arnaud Mounier arnaud.mounier@dijon.inra...
Fri Jan 24 03:25:52 CST 2014

Hi everyone,

first post so I introduce myself, I'm a data engineer in bio research 
lab in France. I want to setup notebooks for the researchers and I'm 
stuck with this problem : I didn't suceed to Image display in the 
notebook from an external python script (see bellow).

I follow this post

and my cell is this
IN %run test_display.py

Hello World ;).

Image ./data/img/yin-yang.png doesn't appear. The script is in the same 
path were notebook is launch and notebook is launch like this :

ipython notebook --pylab inline

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 ?



the test script :

     #!/usr/bin/env python
     # -*- coding: utf-8 -*-

     import sys
     import getopt
     import os.path
     from IPython.core.display import Image

     class Usage(Exception):
         def __init__(self, msg):
             self.msg = msg

     def main(argv=None):
         if argv is None:
             argv = sys.argv
                 opts, args = getopt.getopt(argv[1:], "h", ["help"])
             except getopt.error, msg:
                  raise Usage(msg)
             # more code, unchanged
         except Usage, err:
             print >>sys.stderr, err.msg
             print >>sys.stderr, "for help use --help"
             return 2

         print "Hello World ;)."
         f_test = './data/img/yin-yang.png'
         print os.path.isfile(f_test)


     if __name__ == "__main__":

Arnaud Mounier
INRA - UMR Agroécologie 1347
CNRS - ERL IPM 6300 (Plant-Microorganism Interaction)
17, rue Sully - BP 86510 - F-21065 Dijon Cedex - France
Work phone : +33 380 693 167 - Fax : +33 380 693 753


More information about the IPython-User mailing list