To run Python code from a STAX job, you don't use the STAF Python support 
(i.e. PySTAF).  The STAX service uses its own (embedded) Python support. 
So you can have a STAX job like:

<stax>

  <defaultcall function="main"/>

  <function name="main">

    <sequence>

      <script>
        import time
        from time import strftime
        starttime = time.strftime("%Y%m%d-%H:%M:%S")
      </script>

      <message log="1">'Start time: %s' % (starttime)</message>

    </sequence>

  </function>

</stax>
 
And it should run without any errors.  Here is the output I get from 
running this job:

20090708-19:03:12  Start time: 20090708-19:03:12             

Thanks, 
David 

David Bender 
STAF/STAX Development 
IBM Software Group, WPLC 
 
11501 Burnet Rd. 
Bldg. 903-5B002 
Austin, TX 78758-3400 
 
Phone (T/L): 1-512-286-5315 (363-5315) 
ITN: 23635315 
Email: bda...@us.ibm.com 
 





Alexander Belyaev <al...@decho.com> 
07/08/2009 06:01 PM

To
staf-users@lists.sourceforge.net
cc

Subject
Re: [staf-users] PySTAF module fails to import






Hi,

I am trying to setup STAF/STAX on my machine that had already Python2.5 
installed before I installed STAF/STAX and I cannot make to load PySTAF.

I checked the STAFPython document 
http://staf.sourceforge.net/current/STAFPython.htm#Header_PySTAF

and my variables:

STAF/Env/PYTHON                 : C:\Python25\python.exe
STAF/Env/PYTHONCASEOK           : PYTHONCASEOK=
STAF/Env/PYTHONPATH             : C:\STAF\bin; C:\Python25;

My errors:

20090708-15:22:52 Error STAXPythonEvaluationError signal raised. 
Terminating job. 

===== XML Information =====

File: C:\STAF\services\stax\samples\open_word.xml, Machine: local://local
Line 16: Error in element type "script".

===== Python Error Information =====

com.ibm.staf.service.stax.STAXPythonEvaluationException: 
Traceback (innermost last):
  File "<pyExec string>", line 1, in ?
ImportError: no module named PySTAF


My part of code:

<script>
             from PySTAF import *
             import time
             import re
             starttime = time.time(); # record starting time 
</script>

Also,

 Directory of C:\STAF\bin

07/06/2009  03:26 PM    <DIR>          .
07/06/2009  03:26 PM    <DIR>          ..
03/29/2009  09:24 PM             2,367 CAList.crt
03/29/2009  09:23 PM           225,280 FmtLog.exe
07/01/2009  03:40 PM    <DIR>          IPv4
07/01/2009  03:40 PM    <DIR>          IPv6
03/29/2009  09:23 PM           274,432 JSTAF.dll
03/29/2009  09:23 PM            88,898 JSTAF.jar
03/29/2009  09:23 PM            88,898 JSTAF.zip
03/29/2009  09:23 PM           180,224 JSTAFSH.dll
03/29/2009  09:24 PM           991,232 libeay32.dll
07/01/2009  03:41 PM    <DIR>          perl510
07/01/2009  03:41 PM    <DIR>          perl56
07/01/2009  03:41 PM    <DIR>          perl58
03/29/2009  09:24 PM               858 pkgIndex.tcl
03/29/2009  09:24 PM           135,168 PLSTAF.dll
03/29/2009  09:24 PM            47,954 PLSTAF.pm
03/29/2009  09:24 PM             6,991 PLSTAFService.pm
03/29/2009  09:24 PM            30,055 PySTAF.py
07/01/2009  03:27 PM            19,232 PySTAF.pyc
03/29/2009  09:24 PM            86,016 PYSTAF.pyd
03/29/2009  09:24 PM             3,310 PySTAFLog.py
07/01/2009  03:27 PM             2,206 PySTAFLog.pyc
03/29/2009  09:24 PM             1,260 PySTAFMon.py
07/01/2009  03:27 PM               947 PySTAFMon.pyc


Any ideas?

Thanks,
A

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge 
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full 
prize 
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to