[Fedora-suds-list] Fixed a Bug to make jython 2.5 work

Heinrich Wesseling hwesseling at psi.de
Fri Jul 3 10:03:24 UTC 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I tried to use suds with jython and ran into two small obstacles for which I would like to
provide a fix:

Versions:
  python-suds-0.3.6 package from https://fedorahosted.org/suds/
  jython 2.5.0 (Release_2_5_0:6476)
  OS: Linux, Ubuntu 8.04.3


1. Problem
==========
I tried installing with easy_install, but an error message occurred. It seemed though that
the package was correctly installed. This is the command sequence and output:


mkdir /tmp/python-site
export PYTHONPATH=/tmp/python-site/
easy_install -H None -f /tmp/ -d /tmp/python-site/ python-suds

- ------------------------------------------------
Creating /tmp/python-site/site.py
Searching for python-suds
Best match: python-suds 0.3.6
Processing python-suds-0.3.6.tar.gz
Running python-suds-0.3.6/setup.py -q bdist_egg --dist-dir
/tmp/easy_install-Wip7VV/python-suds-0.3.6/egg-dist-tmp-tvd4ft
Unknown option: O
usage: jython [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments:
- -c cmd   : program passed in as string (terminates option list)
- -Dprop=v : Set the property `prop' to value `v'
- -C codec : Use a different codec when reading from the console.
- -h       : print this help message and exit (also --help)
- -i       : inspect interactively after running script
           and force prompts, even if stdin does not appear to be a terminal
- -jar jar : program read from __run__.py in jar file
- -m mod   : run library module as a script (terminates option list)
- -Q arg   : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew
- -S       : don't imply 'import site' on initialization
- -u       : unbuffered binary stdout and stderr
- -v       : verbose (trace import statements)
- -V       : print the Python version number and exit (also --version)
- -W arg   : warning control (arg is action:message:category:module:lineno)
file     : program read from script file
- -        : program read from stdin (default; interactive mode if a tty)
arg ...  : arguments passed to program in sys.argv[1:]
Other environment variables:
JYTHONPATH: ':'-separated list of directories prefixed to the default module
            search path.  The result is sys.path.
zip_safe flag not set; analyzing archive contents...
Unable to analyze compiled code on this platform.
Please ask the author to include a 'zip_safe' setting (either True or False) in the
package's setup.py
Adding suds 0.3.6 to easy-install.pth file

Installed /tmp/python-site/suds-0.3.6-py2.5.egg
Skipping dependencies for suds 0.3.6
- -----------------------------------------------

This error occurred, because jython doesn't recognize the -O option and also has no
similar one. To fix this, I removed the file setup.cfg with the only option optimize=1
from the distribution. That fixed the problem and I could install without messages.


2. Problem
==========
After the successful installation of suds instanciating the client threw an Exception that
complained about an unknown attribute in the module sudsobject.py (see below):
I found that the line 106 in sudsobject.py stating
code = code.co_consts[0]

could *not* be executed in jython but could be executed in cpython. I did not understand
the exact meaning of that line but after uncommenting it, suds ran as expected with
jython. I only have a limited amount of testcases, so maybe the commented line may cause
errors in other contexts.

I would kindly ask the maintainer to consider this fixes for commit, providing that there
is no better solution to make suds run with jython.
Thanks for that great piece of work.

Heinrich Wesseling

P.S. I attached the small test script and the wsdl file of the webservice.

- --------------------------------------------
Traceback (most recent call last):
  File "/home/hwesseli/insa/getJobLog.py", line 4, in <module>
    client = Client(url)
  File
"/home/hwesseli/workspace/cms-trunk/build/run/jython/Lib/site-packages/suds-0.3.6-py2.5.egg/suds/client.py",
line 106, in __init__
    self.wsdl = Definitions(url, options)
  File
"/home/hwesseli/workspace/cms-trunk/build/run/jython/Lib/site-packages/suds-0.3.6-py2.5.egg/suds/wsdl.py",
line 185, in __init__
    self.add_children(self.root)
  File
"/home/hwesseli/workspace/cms-trunk/build/run/jython/Lib/site-packages/suds-0.3.6-py2.5.egg/suds/wsdl.py",
line 211, in add_children
    child = Factory.create(c, self)
  File
"/home/hwesseli/workspace/cms-trunk/build/run/jython/Lib/site-packages/suds-0.3.6-py2.5.egg/suds/wsdl.py",
line 74, in create
    return fn(root, definitions)
  File
"/home/hwesseli/workspace/cms-trunk/build/run/jython/Lib/site-packages/suds-0.3.6-py2.5.egg/suds/wsdl.py",
line 56, in <lambda>
    'portType' : lambda x,y: PortType(x,y),
  File
"/home/hwesseli/workspace/cms-trunk/build/run/jython/Lib/site-packages/suds-0.3.6-py2.5.egg/suds/wsdl.py",
line 487, in __init__
    op = SFactory.object('Operation')
  File
"/home/hwesseli/workspace/cms-trunk/build/run/jython/Lib/site-packages/suds-0.3.6-py2.5.egg/suds/sudsobject.py",
line 115, in object
    subclass = cls.subclass(classname, Object)
  File
"/home/hwesseli/workspace/cms-trunk/build/run/jython/Lib/site-packages/suds-0.3.6-py2.5.egg/suds/sudsobject.py",
line 106, in subclass
    code = code.co_consts[0]
AttributeError: 'tablecode' object has no attribute 'co_consts'
- -------------------------------------------



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKTdds40jDdQmhJV8RAtMMAJ49sUxvBvefwVIjFjXJJxONdlHhhACgxai6
n9e9tMkN2HehXS/h+TMGCtk=
=n3Ac
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InsaCmsService.wsdl
Type: text/xml
Size: 34865 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-suds-list/attachments/20090703/b68ff5a7/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getJobLog.py
Type: text/x-python
Size: 750 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-suds-list/attachments/20090703/b68ff5a7/attachment.py>


More information about the fedora-suds-list mailing list