You could modify your STAX job files to read a Python file and exec the 
contents as part of their initialization.  For example:

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

<stax>

  <defaultcall function="main"/>

  <function name="main">

    <sequence>

      <script>
        myConfigFile = 'C:/staxtest/myConfigFile.py'
        file_object = open(myConfigFile)
        exec(file_object)
        file_object.close()
      </script>

      <message log="1">'x=%s, y=%s' % (x, y)</message>

    </sequence>

  </function>

</stax>

So if myConfigFile.py contained:

x = 'abc'
y = 'def'

Then the output of this STAX job would be:

20080812-08:58:23 x=abc, y=def             

David Bender
STAF/STAX Development
8-1268 (512-838-1268) 
IBM Austin Bldg. 903-5B002
Internet: [EMAIL PROTECTED]




"Ahmed Mostafa" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
08/12/2008 06:59 AM

To
STAF <staf-users@lists.sourceforge.net>
cc

Subject
[staf-users] [STAX] Executing Python script files






Is there a way to execute Python script files in STAX job files other than 
the scriptfile(s) element of the job element?
I want my functions to share some constants that are assigned in a Python 
script file.

Thanks
-- 
Ahmed Mostafa
Software Specialist
IBM Egypt, Cairo Technology Development Center 
0123919750
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's 
challenge
Build the coolest Linux based applications with Moblin SDK & win great 
prizes
Grand prize is a trip for two to an Open Source event anywhere in the 
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to