anil_jacob@... wrote:
> I have this piece of code:
>
> import script1, script2, shared
> inv=random(1,100)
> walk=random(1,100)
>
> class TestRunner:
> runsForThread = 0
> def __init__(self):
> self.rampupcount = 0
>
> def scenarios(self):
> if shared.shouldexecute(self,inv):
> self.testRunner = scrip1.TestRunner()
> elif shared.shouldexecute(self,walk):
> self.testRunner = script2.TestRunner()
>
> self.testRunner() -- # "location of Error mentioned below"
>
> # This method is called for every run.
> def __call__(self):
> self.scenarios()
>
> I keep getting this error at the start of a run, the script continues to run fine after the error.
>
> 6/26/08 11:38:32 AM (thread 48 run 0): Aborted run due to Jython exception: AttributeError: testRunner [calling TestRunner]
> AttributeError: testRunner
> File: mainscript.py ine 11
>
> I am Unable to figure out why that error is happening. Won't the instance have testRunner attribute?
> Please advice.
>
What if neither the if clause or the elif clause matched? In that case,
you wouldn't have assigned anything to self.testRunner.
- Phil
|