Hello,
I have the following jython module which runs fine with jython 2.2.1.
The modul controls the call of further jython modules.
from net.grinder.script import Test
from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
from HTTPClient import NVPair
from sit.grinder import XMLDataHandler
from at.spardat.gcms.grindertest import GcmsXMADataHandler
Hello,
I have the following jython module which runs fine with jython 2.2.1.
The modul controls the call of further jython modules.
from net.grinder.script import Test
from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
from HTTPClient import NVPair
from sit.grinder import XMLDataHandler
from at.spardat.gcms.grindertest import GcmsXMADataHandler
dataHandler = GcmsXMADataHandler.getHandler("all", grinder.statistics)
dataHandler.enableDebug()
scripts = dataHandler.getAllScripts()
# Ensure modules are initialised in the process thread.
for script in scripts: exec("import %s" % script)
def createTestRunner(script):
exec("x = %s.TestRunner()" % script)
return x
class TestRunner:
def __init__(self):
#tid = grinder.getThreadNumber()
nextScript = dataHandler.getNextScript()
self.testRunner = createTestRunner(nextScript)
# This method is called for every run.
def __call__(self):
self.testRunner()
The Pydev editor states the following error:
undefined variable x (line 17)
Do anybody have some suggestions what goes wrong?
:-Q ferry
PyDev won't analyze/execute code in exec statements, so, it doesn't know that
exec("x = %s.TestRunner()" % script)
will end up with a 'x' in the namespace.
you could change that to be:
x = eval('%s.TestRunner()' % script) and then it'd at least get 'x' in the namespace.
Cheers,
Fabio