Ignore:
Timestamp:
05/04/12 11:49:51 (2 years ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
rebase_source:
baa9d35e0f787cdac2210dcba69df6b2ea9d547c
Message:

Print stack trace if domain translation raises an exception.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/Prototypes/OWTranslateDomain.py

    r10813 r10864  
    1111 
    1212import OWGUI 
    13  
    1413import Orange 
    1514 
     15 
    1616class OWTranslateDomain(OWWidget): 
    17     def __init__(self, parent=None, signalManager=None, title="Translate Domain"): 
    18         OWWidget.__init__(self, parent, signalManager, title, wantMainArea=False) 
     17    def __init__(self, parent=None, signalManager=None, 
     18                 title="Translate Domain"): 
     19        OWWidget.__init__(self, parent, signalManager, title, 
     20                          wantMainArea=False) 
    1921 
    2022        self.inputs = [("Target Domain", Orange.data.Table, self.set_target), 
     
    5254                class_str = "no" 
    5355            num_features = len(self.target.domain.features) 
    54             target_lines = ["Target domain with %i features and %s class." % (num_features, class_str)] 
     56            target_lines = ["Target domain with %i features and %s class." % \ 
     57                            (num_features, class_str)] 
    5558        if self.input_data is not None: 
    56             input_lines = ["Input data with %i instances" % len(self.input_data)] 
     59            input_lines = ["Input data with %i instances" % \ 
     60                           len(self.input_data)] 
    5761        self.info.setText("\n".join(target_lines + input_lines)) 
    5862 
     
    6468                translated = self.input_data.translate(self.target.domain) 
    6569            except Exception, ex: 
     70                import traceback 
     71                traceback.print_exc(limit=8, file=sys.stdout) 
    6672                self.error("Failed to convert the domain (%r)." % ex) 
    6773        self.send("Translated Data", translated) 
Note: See TracChangeset for help on using the changeset viewer.