Hai, My STAF Environment Details:
python version is 2.7.3 java version 1.6 os is ubuntu 12.04 $ STAF local MISC LIST PROPERTIES output is, version : 3.4.12 platform : linux architecture: 32-bit installer : IA file : STAF3412-setup-linux.bin osname : Linux osversion : * osarch : x86 *1. Python Command* staf local process start command python parms "oldSTAFTestcase" Response -------- 5 *2. Java Command* staf local process start command java parms "STAFTestcase" Response -------- 8 *Response for Commands* staf local process list handles Response -------- Handle Command Start Date-Time End Date-Time Return Code ------ ------- ----------------- ----------------- -----------5 *python* 20130705-12 <tel:20130705-12>:54:51 20130705-12 <tel:20130705-12>:54:52 *2 * 8 *java* 20130705-12 <tel:20130705-12>:58:29 20130705-12 <tel:20130705-12>:58:40 *0 *
Here, I am attaching files which producing above return codes. so kindly help me.
When I am running the oldSTAFTestcase.py with python seperately, it's working fine
*Command:* $ python oldSTAFTestcase.py OS Name: Linux Loop # 0 Loop # 1 Loop # 2 .... .... .... Loop # 97 Loop # 98 Loop # 99 But when i am running under staf environment it's giving response code 2. I exported PYTHONPATH export PYTHONPATH=/usr/local/staf/lib:${PYTHONPATH} (oldSTAFTestcase.py exist in /usr/local/staf/lib) Thanks & Regards, N. Asok Kumar
from PySTAF import * import sys import time try: handle = STAFHandle("STAFTestcase") except STAFException, e: print "Error registering with STAF, RC: %d" % e.rc sys.exit(e.rc) result = handle.submit("local", "var", "resolve string {STAF/Config/OS/Name}") if (result.rc != 0): print "Error submitting request, RC: %d, Result: %s" % (result.rc, result.result) else: print "OS Name: %s" % result.result count=100 for x in range(0, count): print "Loop #" ,x result = handle.submit("local", "monitor", "log message " + "Loop # ") time.sleep(1) if (result.rc != 0): print "Error submitting request, RC: %d, Result: %s" % (result.rc, result.result) rc = handle.unregister() sys.exit(rc)
import com.ibm.staf.*; public class STAFTestcase { public static void main(String[] args) { int counter = 10; STAFHandle handle = null; try { handle = new STAFHandle("STAFTestcase"); } catch(STAFException e) { e.printStackTrace(); System.exit(1); } if (args.length > 0) counter = (new Integer(args[0])).intValue(); for (int i=0; i < counter; i++) { System.out.println("Loop #" + i); STAFResult result = handle.submit2("local", "monitor", "log message " + STAFUtil.unwrapData("Loop #" + i)); try { Thread.sleep(1000); // 1 second } catch(InterruptedException e) { e.printStackTrace(); } } System.exit(0); } }
------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev
_______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users