Jython (not STAX) uses a "u" prefix to indicate a string is a unicode 
string for the string entries in the STAXResult when you log the contents 
of the entire STAXResult variable.
For example:  u'File 1 data'.

The content of the STAXResult variable set after a <process> element is 
talked about in section "process: Run a process" in the STAX User's Guide 
at http://staf.sourceforge.net/current/STAX/staxug.html#Header_Process. 
After a <process> element is executed, the STAXResult variable will be set 
as follows:

STAXResult - contains any files specified by returnstdout, returnstderr, 
and/or returnfile(s). If no files are returned, STAXResult is set to 
special Python object None. If one or more files are returned, the format 
of STAXResult is a list as follows: 

[ [<File 1 rc>, <File 1 data>], [<File 2 rc>, <File 2 data> ], ... ]

Each entry in the list represents a returned file and consists of a 
2-element list as follows: 
1.      <File n rc> is a number containing the STAF return code indicating 
the success or failure of retrieving the file's contents 
2.      <File n data> is a string containing the file's contents 
Files will be returned in the order of standard output, then standard 
error, then any files specified with the returnfile(s) element(s). 
For example, assume that the standard output of a process was simply "This 
is stdout data", and that the standard error of a process was "This is 
stderr data", and that you asked for both of these to be returned. 
STAXResult would look like the following. 
[ [0, u'"This is stdout data"\r\n'], [0, u'"This is stderr data"\r\n'] ]

Here's an example of a STAX job that shows how you can log a process's 
returned file content without the "u" prefix (unicode string 
representation):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>

<defaultcall function="main" />

<function name="main">
  <sequence>

    <!-- A STAXResult variable from a process that started successfully 
and returns
         one or more files will be a list with the following content:

         [ [<File 1 rc>, <File 1 data>], [<File 2 rc>, <File 2 data> ], 
... ]

         The file data entries in the list are unicode strings and will be 
logged
         with the "u" prefix when logging the entire STAXResult variable.
         For example:

         STAXResult=[[0, u'"This is a test"\r\n'], [0, u'']]
       -->

    <log message="1">'Test 1: Log a process STAXResult variable'</log>

    <process>
      <location>'local'</location>
      <command mode="'shell'">'echo "This is a test"'</command>
      <stderr mode="'stdout'"/>
      <returnstdout/>
    </process> 

    <log message="1">'Process RC=%s STAFResult=%s STAXResult=%s' % (RC, 
STAFResult, STAXResult)</log>


    <!--  Show how to log a process's returned files (e.g. stdout, stderr) 
string
          content individually (so that the file content does not have the 
"u" prefix).
          For example:

          Process STAXResult[0,1]="This is a test"
      -->

    <log message="1">'Test 2: Log a process STAXResult[0][1] 
variable'</log>

    <process>
      <location>'local'</location>
      <command mode="'shell'">'echo "This is a test"'</command>
      <stderr mode="'stdout'"/>
      <returnstdout/>
    </process> 

    <if expr="RC != 0">
      <log message="1">
        'Process failed with RC=%s, Result=%s' % (RC, STAFResult)
      </log>
    </if>

    <if expr="STAXResult != None">
      <iterate var="fileInfo" in="STAXResult" indexvar="i">
        <sequence>
          <!-- Log each string containing the returned file contents 
individually
               to avoid seeing the unicode string representation: u'The 
string' -->
          <log message="1">'Process STAXResult[%s,1]=%s' % (i, 
fileInfo[1])</log>
        </sequence>
      </iterate>
      <else>
        <log message="1">'Process STAXResult=%s' % (STAXResult)</log>
      </else>
    </if>

  </sequence>
</function>

</stax>

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   deepak bhatt <engdeepak_bh...@yahoo.co.in>
To:     Sharon Lucas/Austin/IBM@IBMUS, 
Cc:     "staf-users@lists.sourceforge.net" 
<staf-users@lists.sourceforge.net>
Date:   06/22/2014 11:27 PM
Subject:        Re: [staf-users] Python issue with new STAF



HI Sharon Lucas,

That issue has fixed by doing some changes in python code. I am getting 
one more issue with new STAF/STAX. In logging I can see STAX is prefixing 
extra character "u" in result and while parsing the parameters from xml 
file. Do you have any idea why it is sending this extra character. 
Thanks in advance.


STAXResult=[[0, u'Response\n--------\n\n']]

 CONFIRM" with arguments None
20140623-13:00:27|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF BackupServer5 FS DELETE ENTRY D:/QA_ATF_RUN/atf_win 
RECURSE CONFIRM" with arguments None .successfully: STAFResult=None 
STAXResult=[[0, u'Response\n--------\n\n']]
20140623-13:00:27|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF BackupServer5 FS CREATE DIRECTORY D:/QA_ATF_RUN/atf_win 
FULLPATH FAILIFEXISTS" with arguments None
20140623-13:00:28|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Created
 
WIN_DIR:D:/QA_ATF_RUN/atf_win successfully!
20140623-13:00:28|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Set
 
WIN_DIR=D:/QA_ATF_RUN/atf_win
20140623-13:00:28|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF local FS COPY DIRECTORY 
/home/hydragui/ATF/bin/../tests.staf/winfiles/STAF/Utilities TODIRECTORY 
"D:/QA_ATF_RUN/atf_win/STAF/Utilities" TOMACHINE BackupServer5 RECURSE 
KEEPEMPTYDIRECTORIES" with arguments None
20140623-13:00:32|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF local FS COPY DIRECTORY 
/home/hydragui/ATF/bin/../tests.staf/winfiles/STAF/Utilities TODIRECTORY 
"D:/QA_ATF_RUN/atf_win/STAF/Utilities" TOMACHINE BackupServer5 RECURSE 
KEEPEMPTYDIRECTORIES" with arguments None .successfully: STAFResult=None 
STAXResult=[[0, u'Response\n--------\n\n']]
20140623-13:00:32|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF local FS COPY DIRECTORY 
/home/hydragui/ATF/bin/../tests.staf/winfiles/winWriteTool TODIRECTORY 
"D:/QA_ATF_RUN/atf_win/winWriteTool" TOMACHINE BackupServer5 RECURSE 
KEEPEMPTYDIRECTORIES" with arguments None
20140623-13:00:35|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF local FS COPY DIRECTORY 
/home/hydragui/ATF/bin/../tests.staf/winfiles/winWriteTool TODIRECTORY 
"D:/QA_ATF_RUN/atf_win/winWriteTool" TOMACHINE BackupServer5 RECURSE 
KEEPEMPTYDIRECTORIES" with arguments None .successfully: STAFResult=None 
STAXResult=[[0, u'Response\n--------\n\n']]
20140623-13:00:35|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF local FS COPY FILE 
/home/hydragui/ATF/bin/../tests.staf/winfiles/ComparePath.exe TODIRECTORY 
"D:/QA_ATF_RUN/atf_win/" TOMACHINE BackupServer5" with arguments None
20140623-13:00:36|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF local FS COPY FILE 
/home/hydragui/ATF/bin/../tests.staf/winfiles/ComparePath.exe TODIRECTORY 
"D:/QA_ATF_RUN/atf_win/" TOMACHINE BackupServer5" with arguments None 
.successfully: STAFResult=None STAXResult=[[0, u'Response\n--------\n\n']]
20140623-13:00:36|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF local FS COPY FILE 
/home/hydragui/ATF/bin/../tests.staf/unixfiles/writeTool/tool/hfs_readPerformanceTest.exe
 
TODIRECTORY "D:/QA_ATF_RUN/atf_win" TOMACHINE BackupServer5" with 
arguments None
20140623-13:00:37|backupserver22|42|STAX/Job/1|none://anonymous|local://local|Info|Executing
 
on local: "STAF local FS COPY FILE 
/home/hydragui/ATF/bin/../tests.staf/unixfiles/writeTool/tool/hfs_readPerformanceTest.exe
 
TODIRECTORY "D:/QA_ATF_RUN/atf_win" TOMACHINE BackupServer5" with 
arguments None .successfully: STAFResult=None STAXResult=[[0, 
u'Response\n--------\n\n']]


On Friday, 20 June 2014 11:50 AM, deepak bhatt 
<engdeepak_bh...@yahoo.co.in> wrote:


Thanks Sharon Lucas I will try what you suggested.

Regards,
Deepak


On Thursday, 19 June 2014 7:41 PM, Sharon Lucas <luc...@us.ibm.com> wrote:


The latest release of the STAX service is Version 3.5.9. Note that this 
STAX version provides support for Jython 2.5.2 (instead of Jython 2.1 
which is what is supported by STAX V3.4.5 and earlier).   There were 
significant changes in Jython from 2.1 to 2.5.2.  This is talked about in 
the STAX History file and on the STAX download web page at 
http://staf.sourceforge.net/getstax.php.  Jython is used to execute the 
code within a <script> element in a STAX job. 

If you provide the content of your <script> element at line 333 in file 
/home/hydragui/ATF/lib/framework.xml, I can try to help you resolve the 
issue.  The Jython error message states that in line 10 within this 
<script> element, it is encountering error:  "OverflowError: an integer is 
required".  And what is the value of the variable(s) used in line 10 of 
this <script> element?  It appears that an integer is not being used for 
something that requires an integer.  Integer operations that flow outside 
the range of integer values raise an OverflowError.  If an integral 
numeric risks exceeding the maximum value for a PyInteger (2147483647), it 
should be made a long integer (PyLong) by adding the L suffix (e.g. 0L 
instead of 0).  You can also google for more information on this 
Jython/Python error message.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:        deepak bhatt <engdeepak_bh...@yahoo.co.in> 
To:        "staf-users@lists.sourceforge.net" 
<staf-users@lists.sourceforge.net>, 
Date:        06/19/2014 08:41 AM 
Subject:        [staf-users] Python issue with new STAF 



Hi , 

I recently updated my STAF version . I am getting below error while 
execution which I never got with old version. 
Did anybody have any idea what could be the issue. 

---------------------------------------------------------------------------\ 

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

File: /home/hydragui/ATF/lib/framework.xml, Machine: local
Line 333: Error in element type "script".

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

com.ibm.staf.service.stax.STAXPythonEvaluationException:
Traceback (most recent call last):
 File "<pyExec string>", line 10, in <module>
OverflowError: an integer is required

===== Call Stack for STAX Thread 1 =====

[
 function: testSequence (Line: 12, File: /hom 
-------------------------------------- 

Thanks in advance. 

Regards, 
Deepak
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users






------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to