Are you sure? I ran the example fine with the correct spelling and got your error with the Typo example. <project name="j" default="j"> <target name="j"> <property name="message" value="message"/> <script language="jython"> import org.apache.tools.ant.taskdefs.Mkdir as Mkdir import java.io.File as File print "Ant Call Test" print project.getProperty('build.dir') print project.getName() testDir=File('./test') mkdir = Mkdir()
mkdir.setDir(testDir) print "Here is fine" </script> </target> </project> prints: Buildfile: jython.xml j: [script] Ant Call Test [script] None [script] j [script] Here is fine BUILD SUCCESSFUL Total time: 1 second Peter On 8/10/06, Hussein Badakhchani <[EMAIL PROTECTED]> wrote:
Thanks, your right that was a typo in my message. I still have the error. -----Original Message----- From: Peter Reilly [mailto:[EMAIL PROTECTED] Sent: 10 August 2006 14:32 To: Ant Users List Subject: Re: Calling ant tasks from jython just a quick look: Mkdir.setDir(testDir) should be mkdir.setDir(testDir) Peter On 8/10/06, Hussein Badakhchani <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I am calling a jython script from my build.xml file using the script > task e.g: > > > > <script language="jython" src="tools/jython/antCallTest.py"/> > > > > I want to use ant tasks from antCallTest.py. While I don't seem to have > any problems retrieving my projects properties it seems that any call I > make to an ant task method requires an extra argument. > > For example: > > > > Script called from my build.xml file > > > > import org.apache.tools.ant.taskdefs.Mkdir as Mkdir > > import java.io.File as File > > > > # These calls all work file > > print "Ant Call Test" > > print project.getProperty('build.dir') > > print project.getName() > > > > testDir=File('./test') > > mkdir = Mkdir() > > > > # At this point I get the error > > Mkdir.setDir(testDir) > > > > > > Traceback (innermost last): > > File "<string>", line 10, in ? > > TypeError: setDir(): expected 2 args; got 1 > > > > > > The setDir method only accepts 1 argument as per the api. > > I have tried passing in an instance of self but I get the following > error: > > > > Mkdir.setDir(self, testDir) > > > > Traceback (innermost last): > > File "<string>", line 10, in ? > > TypeError: setDir(): self arg can't be coerced to > > > > Jython does not tell me what object self cannot be coerced to! > > > > What am I missing here? > > > > Hussein Badakhchani > > Middleware Analyst > > Infrastructure Support > > > > Blog: http://dev2dev.bea.com/blog/hoos/ > > > > > > > > ***************************************************** > > You can find us at www.voca.com > > ***************************************************** > This communication is confidential and intended for > the exclusive use of the addressee only. You should > not disclose its contents to any other person. > If you are not the intended recipient please notify > the sender named above immediately. > > Registered in England, No 1023742, > Registered Office: Voca Limited > Drake House, Three Rivers Court, > Homestead Road, Rickmansworth, > Hertfordshire, WD3 1FX > > > This message has been checked for all email viruses by MessageLabs. > This message has been checked for all email viruses by MessageLabs. This message has been checked for all email viruses by MessageLabs. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]