Here's an example of how to use the Python string find method:
<script>
str = 'c:/foo/bar/hi.there'
n = str.find('hi')
</script>
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
Stephan Lips <stephan.l...@gmail.com>
03/12/2009 09:44 AM
To
Sharon Lucas/Austin/i...@ibmus
cc
staf-users@lists.sourceforge.net
Subject
Re: [staf-users] python built-in method not recognized?
Thanks. I seem to have problems with Python 2.1 methods as well, though.
In particular, I am trying to find if a given substring exists in a string
using the find() function, which according to
http://www.python.org/doc/2.1.3/lib/string-methods.html should work in
2.1. The following test function yields the below results. Am I missing
something?
Thanks again,
- Stephan
<function name="substring">
<sequence>
<script>
str = 'c:/foo/bar/hi.tere'
n = find(str, 'hi')
</script>
<message>'Found at position: %s' % n</message>
</sequence>
</function>
20090312-09:39:30 STAXPythonEvaluationError signal raised. Terminating
job.
===== Element Information =====
<script>str = "c:/foo/bar/hi.tere"
n = find(str, "hi")
</script>
===== Python Error Information =====
com.ibm.staf.service.stax.STAXPythonEvaluationException: Traceback
(innermost last):
File "<pyExec string>", line 2, in ?
NameError: find
===== Call Stack for STAX Thread 1 =====
[
Block: main
Sequence: 18/18
Function: substring
Sequence: 1/2
]
On Wed, Mar 11, 2009 at 3:48 PM, Sharon Lucas <luc...@us.ibm.com> wrote:
That's because stf.rpartition was added in Python 2.5. It's not available
yet in Jython. STAX uses Jython 2.1, not Python to run Python code in a
STAX script. The Jython developers are currently working on beta releases
for Jython 2.5. Sometime after Jython 2.5 GAs, we plan to update STAX to
include Jython 2.5, not Jython 2.1.
See "Appendix F: Jython and CPython Differences" in the STAX User's Guide
for more information.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
Stephan Lips <stephan.l...@gmail.com>
03/11/2009 03:23 PM
To
staf-users@lists.sourceforge.net
cc
Subject
[staf-users] python built-in method not recognized?
Hi there,
the following little test of python's built-in str.rpartition appears to
not be recognized when running this through a STAX script, as the below
error suggests. Any idea what I'm missing to get this to execute as
expected?
Thanks,
- Stephan
<function name="rpartition">
<sequence>
<script>
str = 'c:/foo/bar/hi.tere'
segments = str.rpartition('/')
</script>
<message>segments[0]</message>
<message>segments[2]</message>
</sequence>
20090311-15:20:52 STAXPythonEvaluationError signal raised. Terminating
job.
===== Element Information =====
<script>str = 'c:/foo/bar/hi.tere'
segments = str.rpartition('/')
</script>
===== Python Error Information =====
com.ibm.staf.service.stax.STAXPythonEvaluationException: Traceback
(innermost last):
File "<pyExec string>", line 2, in ?
AttributeError: 'string' object has no attribute 'rpartition'
===== Call Stack for STAX Thread 1 =====
[
Block: main
Sequence: 18/18
Function: rpartition
Sequence: 1/3
]
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial.
http://p.sf.net/sfu/www-adobe-com_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users