Hi,
Do the 3 lines in your <script> work for you when running them outside of
STAF/STAX? I tried installing lxml-2.2.4.win32-py2.5.exe, and when
running from Python 2.5, I got the same error:
$ python
Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append("C:\\Python25\\Lib\\site-packages\\lxml")
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name etree
>>>
Looking at the documentation at: http://codespeak.net/lxml/tutorial.html
I tried the following and it worked:
>>> import xml.etree.cElementTree as etree
>>>
Having said all that, note that STAX uses Jython V2.1, which is a Java
implementation of Python V2.1. It seems that lxml is built for specific
versions of Python (and does not appear to support Python 2.1), so I don't
think you will be able to use lxml within your STAX job. Using "import
xml.etree.cElementTree as etree" within the <script> results in
"ImportError: No module named etree".
Thanks,
David
David Bender
STAF/STAX Development
IBM Software Group, WPLC
11501 Burnet Rd.
Bldg. 903-5B002
Austin, TX 78758-3400
Phone (T/L): 1-512-286-5315 (363-5315)
ITN: 23635315
Email: [email protected]
From:
staf-stax user <[email protected]>
To:
[email protected]
Cc:
staf-stax user <[email protected]>
Date:
01/05/2010 07:17 AM
Subject:
[staf-users] Issues while importing external python modules.
Hi
I am facing issues while importing "lxml" module through STAX.
lxml package is installed at location
"C:\Python26\Lib\site-packages\lxml".
In my stax.xml I am importing this module by appending syspath. Here is
how I am trying to import etree under lxml. "etree.pyd" file is present
under lxml folder.
**************
<script>
import sys
sys.path.append ("C:\\Python26\\Lib\\site-packages\\lxml")
from lxml import etree
</script>
***************
At this point it is throwing me an error "ImportError: cannot import name
etree"
Regard's
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and
easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users