The job you provided works correctly for me (on a Windows XP system). Here
is the output:
Date-Time Level Message
----------------- -----
-------------------------------------------------------
20080602-08:50:33 Trace path.dirname(
/usr/local/staf/data/STAF/tmpFile.tmp ) =
\usr\local\staf\data\STAF
20080602-08:50:33 Trace path.split( /usr/local/staf/data/STAF/tmpFile.tmp
) = \
usr\local\staf\data\STAF
What output do you get?
David Bender
STAF/STAX Development
8-1268 (512-838-1268)
IBM Austin Bldg. 903-5B002
Internet: [EMAIL PROTECTED]
"Ahmed Mostafa" <[EMAIL PROTECTED]>
06/02/2008 08:12 AM
To
David Bender/Austin/[EMAIL PROTECTED]
cc
staf-users@lists.sourceforge.net
Subject
Re: [staf-users] [Python] path.dirname() and path.split() problem
Here is my STAX job:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="TestDirectory"/>
<function name="TestDirectory">
<sequence>
<script>
from os import path
tempFile = R'/usr/local/staf/data/STAF/tmpFile.tmp'
</script>
<message log='1' level='"trace"'>'path.dirname( %s ) = %s' % (
tempFile, path.dirname( tempFile ) )</message>
<message log='1' level='"trace"'>'path.split( %s ) = %s' % (
tempFile, path.split( tempFile )[0] )</message>
</sequence>
</function>
</stax>
I'm using a Windows XP machine with both Python 2.1 and Python 2.5
installed (that should not affect STAF).
Thanks
2008/6/1 David Bender <[EMAIL PROTECTED]>:
This works correctly for me on a variety of platforms. Here is the STAX
job I used:
<stax>
<defaultcall function="Main"/>
<function name="Main">
<sequence>
<stafcmd>
<location>'local'</location>
<service>'VAR'</service>
<request>'RESOLVE STRING {STAF/Config/OS/Name}'</request>
</stafcmd>
<message log="1">STAFResult</message>
<script>
from os import path
path1 = path.dirname('/usr/local/filename')
path2 = path.split( '/usr/local/filename' )[0]
</script>
<message log="1">path1</message>
<message log="1">path2</message>
</sequence>
</function>
</stax>
On Windows:
Date-Time Level Message
----------------- ----- ----------
20080601-08:58:02 Info WinXP
20080601-08:58:02 Info \usr\local
20080601-08:58:02 Info \usr\local
On Linux:
Date-Time Level Message
----------------- ----- ----------
20080601-10:05:27 Info Linux
20080601-10:05:27 Info /usr/local
20080601-10:05:27 Info /usr/local
On AIX:
Date-Time Level Message
----------------- ----- ----------
20080601-09:04:58 Info AIX
20080601-09:05:04 Info /usr/local
20080601-09:05:04 Info /usr/local
On Solaris:
Date-Time Level Message
----------------- ----- ----------
20080601-09:15:06 Info SunOS
20080601-09:15:07 Info /usr/local
20080601-09:15:07 Info /usr/local
On HPUX:
Date-Time Level Message
----------------- ----- ----------
20080601-09:15:17 Info HP-UX
20080601-09:15:20 Info /usr/local
20080601-09:15:20 Info /usr/local
Can you provide a STAX job that demonstrates the problem you are seeing,
along with details on the platform on which you are executing the STAX
job?
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]
06/01/2008 03:36 AM
To
STAF <staf-users@lists.sourceforge.net>
cc
Subject
[staf-users] [Python] path.dirname() and path.split() problem
Within STAX jobs, using both path.dirname( '/usr/local/filename' ) and
path.split( '/usr/local/filename' )[0] evaluates to '\usr\local\filename'
(according to the machine which is executing the STAX job) causing any
subsequent file operations to fail, while using it in Python shell (Python
2.1) evaluates to the desired value of '/usr/local' regardless of the
executing machine. Why is this difference and how can overcome this
problem?
--
Ahmed Mostafa
0123919750
[EMAIL PROTECTED]
Software Engineer
IBM Egypt, Cairo Technology Development Center
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
--
Ahmed Mostafa
0123919750
[EMAIL PROTECTED]
Software Engineer
IBM Egypt, Cairo Technology Development Center
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users