Changeset 7900:20ccedb368ba in orange


Ignore:
Timestamp:
05/11/11 10:41:15 (3 years ago)
Author:
markotoplak
Branch:
default
Convert:
ce0ab9983d3014c7d3c93a636a3961a1eccb253a
Message:

Addons issue warnings (using python warnings module) istead of printing to the standard input.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/misc/addons.py

    r7887 r7900  
    121121from fileutil import _zip_open 
    122122from zipfile import ZipFile 
     123 
     124import warnings 
    123125 
    124126socket.setdefaulttimeout(120)  # In seconds. 
     
    14401442                addOn = OrangeAddOnInstalled(addOnDir) 
    14411443            except Exception, e: 
    1442                 print "Add-on in directory '%s' has no valid descriptor (addon.xml): %s" % (addOnDir, e) 
     1444                warnings.warn("Add-on in directory '%s' has no valid descriptor (addon.xml): %s" % (addOnDir, e), Warning, 0) 
    14431445                continue 
    14441446            if addOn.id in installed_addons: 
    1445                 print "Add-on in directory '%s' has the same ID as the addon in '%s'!" % (addOnDir, installed_addons[addOn.id].directory) 
     1447                warnings.warn("Add-on in directory '%s' has the same ID as the addon in '%s'!" % (addOnDir, installed_addons[addOn.id].directory), Warning, 0) 
    14461448                continue 
    14471449            installed_addons[addOn.id] = addOn 
     
    14801482            file.close() 
    14811483        except Exception, e: 
    1482             print "Unable to load repository list! Error: %s" % e 
     1484            warnings.warn("Unable to load repository list! Error: %s" % e, Warning, 0) 
    14831485    try: 
    14841486        update_default_repositories(refresh=refresh) 
    14851487    except Exception, e: 
    1486         print "Unable to refresh default repositories: %s" % (e) 
     1488        warnings.warn("Unable to refresh default repositories: %s" % (e), Warning, 0) 
    14871489 
    14881490    if refresh: 
     
    14921494                r.refreshdata(force=False) 
    14931495            except Exception, e: 
    1494                 print "Unable to refresh repository %s! Error: %s" % (r.name, e) 
     1496                warnings.warn("Unable to refresh repository %s! Error: %s" % (r.name, e), Warning, 0) 
    14951497    save_repositories() 
    14961498 
     
    15061508        cPickle.dump(available_repositories, open(listFileName, 'wb')) 
    15071509    except Exception, e: 
    1508         print "Unable to save repository list! Error: %s" % e 
     1510        warnings.warn("Unable to save repository list! Error: %s" % e, Warning, 0) 
    15091511     
    15101512 
Note: See TracChangeset for help on using the changeset viewer.