I'm starting to play around with TGWebServices. I just installed
TGWebServices 1.1.2, TG 1.0.2.2 on the latest Ubuntu 7.04 with python
2.5. So far so good, but I can't even import anything from the
interpreter, as in:
$ python
Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from tgwebservices.controllers import WebServicesRoot, WebServicesController, wsexpose, wsvalidate
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/TGWebServices-1.1.2-py2.5.egg/
tgwebservices/controllers.py", line 14, in <module>
import cElementTree as et
ImportError: No module named cElementTree
What does this message mean? Any idea? Any help would be appreciated.
Thanks a lot in advance.
Regards,
--
Víctor Peinado
[...]
> tgwebservices/controllers.py", line 14, in <module>
> import cElementTree as et
> ImportError: No module named cElementTree
>
>
> What does this message mean? Any idea? Any help would be appreciated.
> Thanks a lot in advance.
I was written with python 2.4 in mind. Either install cElementTree
manually or propose a patch to do this:
at line 14 in tgwebservices/controllers.py
instead of
import cElementTree as et
do:
try:
# python 2.5 way of life :)
import xml.etree.cElementTree as et
except:
# python 2.4
import cElementTree as et
you may have to do this in some other modules also. This comes from the
fact that elementtree was integrated in the standard python library
under the new xml.etree namespace.
Cheers,
Florent.
> I was written with python 2.4 in mind. Either install cElementTree
> manually or propose a patch to do this:
>
> at line 14 in tgwebservices/controllers.py
>
> instead of
>
> import cElementTree as et
>
> do:
>
> try:
> # python 2.5 way of life :)
> import xml.etree.cElementTree as et
> except:
> # python 2.4
> import cElementTree as et
>
> you may have to do this in some other modules also. This comes from the
> fact that elementtree was integrated in the standard python library
> under the new xml.etree namespace.
I've already replaced "import cElementTree as et" by "import
xml.etree.cElementTree as et" at tgwebservices/controllers.py and
tgwebservices/soap.py. Now I get this error when importing anything
from tgwebservices:
>>> from tgwebservices.controllers import WebServicesRoot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/TGWebServices-1.1.2-py2.5.egg/
tgwebservices/controllers.py", line 14, in <module>
import xml.etree.cElementTree as et
ImportError: No module named etree.cElementTree
However, if I try to import cElementTree from the interpreter, it
works:
>>> import xml.etree.cElementTree as et
>>> dir(et)
['Comment', 'Element', 'ElementPath', 'ElementTree', 'PI',
'ProcessingInstruction', 'QName', 'SubElement', 'TreeBuilder',
'VERSION', 'XML', 'XMLID', 'XMLParser', 'XMLParserError',
'XMLTreeBuilder', '__builtins__', '__doc__', '__file__', '__name__',
'dump', 'fromstring', 'iselement', 'iterparse', 'parse', 'tostring']
Any idea? Should I report it for a patch to be added?
Best,
--
Víctor Peinado
> tgwebservices/controllers.py", line 14, in <module>
> import xml.etree.cElementTree as et
> ImportError: No module named etree.cElementTree
>
> However, if I try to import cElementTree from the interpreter, it
> works:
>
> >>> import xml.etree.cElementTree as et
> >>> dir(et)
> ['Comment', 'Element', 'ElementPath', 'ElementTree', 'PI',
> 'ProcessingInstruction', 'QName', 'SubElement', 'TreeBuilder',
> 'VERSION', 'XML', 'XMLID', 'XMLParser', 'XMLParserError',
> 'XMLTreeBuilder', '__builtins__', '__doc__', '__file__', '__name__',
> 'dump', 'fromstring', 'iselement', 'iterparse', 'parse', 'tostring']
>
> Any idea? Should I report it for a patch to be added?
>
yes : the easyest way for you is: easy_install cElementTree
it works I just tested it and with cElementTree installed I can import
everything from TGWS.
Cheers,
Florent.
> > Any idea? Should I report it for a patch to be added?
>
> yes : the easyest way for you is: easy_install cElementTree
>
> it works I just tested it and with cElementTree installed I can import
> everything from TGWS.
You're right, it works! Thanks a lot! :-)
--
Víctor Peinado