[Webtest] how to pass the path of imported python module to <scriptStep>
Chang Su
Chang Su <changsu0822@yahoo.com>
Fri, 19 Jan 2007 16:23:36 -0800 (PST)
Just report back that I was able to go through another
route, which is to use <exec> ant task and pass <env
key="PYTHONPATH" to launch the python program as
someone suggested earlier. It works out well for me.
If someone knows how to do this under jython, please
share, otherwise I will be using <exec> just fine.
thanks!
--- Chang Su <changsu0822@yahoo.com> wrote:
>
> Hi,
>
> I wonder how do I import my python modules inside
> <scriptSteps> under jython,
>
> for example, I have python module test.py. As long
> as
> I pass the directory that test.py resides in to
> python.path in jython registry file (under jython
> installed directory) then it knows how to find it
> under interactive jython program,
>
> bash-3.00# jython
> Jython 2.1 on java1.5.0_01 (JIT: null)
> Type "copyright", "credits" or "license" for more
> information.
> >>> from test import *
> >>> a=test()
> >>> a.func()
> 1
> >>>
>
>
> however when I tried this in <scriptStep> block, it
> cannot recognize test python module.
>
> <scriptStep language="jython">
> <![CDATA[
> from test import *
> a=test()
> a=a.func()
> ]]></scriptStep>
>
>
> ",
>
taskName="scriptStep")com.canoo.webtest.engine.StepExecutionException:
> Error invoking script: Traceback (innermost last):
> File "<string>", line 5, in ?
> ImportError: no module named test
>
>
> questions is, how do I pass the path of the imported
> python module to <scriptStep> under jython??
>
>
> thanks a lot,
>
> Chang
>
>
>
>
>
>
>
>
>
____________________________________________________________________________________
> Expecting? Get great news right away with email
> Auto-Check.
> Try the Yahoo! Mail Beta.
>
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html