STAX uses Jython (a Java implementation of CPython), which does not have 
all of the same functionality as CPython, including the OS module.

Appendix F "Appendix F: Jython and CPython Differences" 
(http://staf.sourceforge.net/current/STAX/staxug.html#Header_CPythonDiffs) 
has more information:

Some standard CPython modules depend on operating system calls that are 
not available under Java. The most notable of these is os, which actually 
does run in Jython, but is missing much of its functionality. 

If you google for "jython popen" you will find some suggestions from other 
jython users on alternatives to popen.

David Bender
STAF/STAX Development
(512-286-5315)
IBM Austin Bldg. 903-5B002
Internet: bda...@us.ibm.com




Yu Rong Tan <tan...@cn.ibm.com> 
05/25/2009 09:39 PM

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

Subject
[staf-users] class 'org.python.modules.os' has no attribute 'popen'






Hi,
Here's subset of my STAX XML code:
<script>
import os
hostname = os.popen("hostname").read().split("\n")
dnsString = os.popen("dnsdomainname").read().split("\n")
</script>

Run it on Lotus Automation which is based on STAF. I got the error below:
===== Python Error Information =====

com.ibm.staf.service.stax.STAXPythonEvaluationException: 
Traceback (innermost last):
File "<pyExec string>", line 2, in ?
AttributeError: class 'org.python.modules.os' has no attribute 'popen' 

But I can run the code in the same machine's python enviroment without 
error, So I suspect that would be STAF, STAX problem.
What do you think?

--
Best Regards, 
YuRong Tan(谭玉蓉) 
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. 
Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to