Orange Forum • View topic - Old style exception in orngWrap.py

Old style exception in orngWrap.py

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

Old style exception in orngWrap.py

Postby bgbg » Sun Feb 06, 2011 8:27

Code: Select all
In [29]: l = orngWrap.ThresholdLearner(orngBayes.BayesLearner, 0.2)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

C:\Python25\Lib\site-packages\orange\doc\datasets\<ipython console> in <module>()

C:\Python26\lib\site-packages\orange\orngWrap.pyc in __new__(cls, examples, weightID, **kwds)
    157         self.__dict__.update(kwds)
    158         if examples:
--> 159             return self.__call__(examples, weightID)
    160         else:
    161             return self

C:\Python26\lib\site-packages\orange\orngWrap.pyc in __call__(self, examples, weightID)
    163     def __call__(self, examples, weightID = 0):
    164         if not hasattr(self, "learner"):
--> 165             raise "learner not set"
    166
    167         classifier = self.learner(examples, weightID)

TypeError: exceptions must be old-style classes or derived from BaseException, not str


This is easily fixed by modifying line 165 to
Code: Select all
raise Exception("learner not set")


The same goes for lines 208, 210, 212 of this file

Re: Old style exception in orngWrap.py

Postby Ales » Mon Feb 07, 2011 11:09

Thanks. I will fix this.


Return to Bugs



cron