Biostar Beta. Not for public use.
Error With Kegg Api Sample Code For Python
Entering edit mode
2.5 years ago
JRCX • 10


I'm new in programming, coming from Engineering background. When trying to run KEGG APi sample code for Python in Pycharm (first do pip install SOAPpy)

#!/usr/bin/env python

from SOAPpy import WSDL

wsdl = ''
serv = WSDL.Proxy(wsdl)

results = serv.get_genes_by_pathway('path:eco00020')
print results

I get the following error on the line serv = WSDL.Proxy(wsdl):

Traceback (most recent call last):
File "<console>", line 1, in <module>
  File "C:\Python27\lib\site-packages\SOAPpy\", line 85, in __init__
    self.wsdl = reader.loadFromString(str(wsdlsource))

  File "C:\Python27\lib\site-packages\wstools\", line 47, in loadFromString
    return self.loadFromStream(StringIO(data))

  File "C:\Python27\lib\site-packages\wstools\", line 28, in loadFromStream
    document = DOM.loadDocument(stream)

  File "C:\Python27\lib\site-packages\wstools\", line 645, in loadDocument
    return xml.dom.minidom.parse(data)

  File "C:\Python27\lib\xml\dom\", line 1914, in parse
    return expatbuilder.parse(file)

  File "C:\Python27\lib\xml\dom\", line 928, in parse
    result = builder.parseFile(file)

  File "C:\Python27\lib\xml\dom\", line 207, in parseFile
    parser.Parse(buffer, 0)

ExpatError: not well-formed (invalid token): line 1, column 5

Can someone please help me with it? Thanks in advance.

python • 2.8k views
Entering edit mode

I can confirm that I get the same error. I'm looking into it to see if I can find a solution, but maybe file a bug already with KEGG?

Entering edit mode
13 months ago
France/Nantes/Institut du Thorax - INSE…

It's not a programming problem: the URL of the WSDL ( ) seems wrong from here :

Access forbidden! (403)

see also:

The current SOAP-based API service has not been updated for five years (see ChangeLog) and has become obsolete in certain aspects. Because the original developer is no longer with us at KEGG, we have decided to move to the new service with a much simpler design. The old service will continue to be accessible for six months, until December 31, 2012.

Entering edit mode
12 months ago
Leandro Lima • 920
San Francisco, CA

Well... just to help.

Please download. If you want, it's possible to do it with a local file.

serv = WSDL.Proxy('KEGG.wsdl')

Entering edit mode

Dear Joana, use it only if you're in a hurry. But I recommend you to do like Pierre said (using REST).


Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.1