Ignore:
Timestamp:
Jan 12, 2020 3:52:53 PM (3 years ago)
Author:
toby
Message:

fix bug version in PIL/pillow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4238 r4249  
    344344    print ("  scipy:      %s"%sp.__version__)
    345345    print ("  OpenGL:     %s"%ogl.__version__)
    346     # TODO: not sure this prints the right message with pillow
     346    Image = None
     347    version = '?'
    347348    try:
    348349        from PIL import Image
    349         try:
    350             from PIL import PILLOW_VERSION
    351             version = PILLOW_VERSION
    352         except:
    353             version = Image.VERSION
    354         print ("  PIL.Image:  %s"%version)
    355350    except ImportError:
    356351        try:
    357352            import Image
    358             print ("Image (PIL):%s"%Image.VERSION)
    359353        except ImportError:
    360             print ("Image module not present; Note that PIL (Python Imaging Library) or pillow is needed for some image operations")
     354            pass
     355    if Image is None:
     356        print ("Image module not present; Note that PIL (Python Imaging Library) or pillow is needed for some image operations")
     357    else:
     358        # version # can be in various places, try standard dunderscore first
     359        for ver in '__version__','VERSION','PILLOW_VERSION':
     360            if hasattr(Image,ver):
     361                try:
     362                    version = eval('Image.'+ver)
     363                    break
     364                except:
     365                    pass
     366        print ("  Image:      %s (PIL or Pillow)"%version)
    361367    print ("  Platform:   %s %s %s"%(sys.platform,platform.architecture()[0],platform.machine()))
    362368    try:
Note: See TracChangeset for help on using the changeset viewer.