kartagis / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

SoapFault returns bytes, incompatible with Python 3 #116

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an instance of SoapClient
2. Make a service request that results in a SoapFault

What is the expected output? What do you see instead?
The expected output is a SoapFault exception, but the actual error is: <class 
'str'>: (<class 'TypeError'>, TypeError('__str__ returned non-string (type 
bytes)',))

What version of the product are you using? On what operating system?
Pysimplesoap version 1.11 (cloned from the repo an hour ago) on Windows 7 with 
Python 3.3. 

Please provide any additional information below.

A .patch to fix the issue is attached.

Full stack trace/steps to reproduce:
In [1]: import pysimplesoap

In [2]: c = 
pysimplesoap.client.SoapClient(wsdl="https://www.lendingclub.com/ws/1.3?wsdl")

In [3]: c.SystemGetVersion()
---------------------------------------------------------------------------
SoapFault                                 Traceback (most recent call last)
<ipython-input-3-590893c861cd> in <module>()
----> 1 c.SystemGetVersion()

C:\...\pysimplesoap\client.py in <lambda>(
    157             return lambda self=self, *args, **kwargs: self.call(attr, *args, **kwargs)
    158         else:  # using WSDL:
--> 159             return lambda *args, **kwargs: self.wsdl_call(attr, *args, 
**kwargs)
    160
    161     def call(self, method, *args, **kwargs):

C:\...\pysimplesoap\client.py in wsdl_call
args)
    310
    311         # call remote procedure
--> 312         response = self.call(method, *params)
    313         # parse results:
    314         resp = response('Body', ns=soap_uri).children().unmarshall(output)

C:\...\pysimplesoap\client.py in call(self

    232                                     jetty=self.__soap_server in ('jetty',))
    233         if self.exceptions and response("Fault", ns=list(soap_namespaces.values()), er
--> 234             raise SoapFault(response.faultcode, response.faultstring)
    235         return response
    236

<class 'str'>: (<class 'TypeError'>, TypeError('__str__ returned non-string 
(type bytes)',))

Original issue reported on code.google.com by pcollins...@gmail.com on 17 Sep 2013 at 5:48

Attachments:

GoogleCodeExporter commented 8 years ago
Yes, this is a known issue, I think we should add an if to convert it to string 
on py2 and leave unicode in py3 

Original comment by reingart@gmail.com on 17 Sep 2013 at 6:02

GoogleCodeExporter commented 8 years ago
Yes, this is a known issue, I think we should add an if to convert it to string 
on py2 and leave unicode in py3 

Original comment by reingart@gmail.com on 17 Sep 2013 at 6:02

GoogleCodeExporter commented 8 years ago
I propose a patch

Original comment by gaetano....@spacespa.it on 25 Dec 2013 at 3:04

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you! 

Could you make a pull request on github?

https://github.com/pysimplesoap/pysimplesoap

(that would be faster and cleaner to merge)

Also, if you can, please add a unit test

Original comment by reingart@gmail.com on 26 Dec 2013 at 6:11

GoogleCodeExporter commented 8 years ago
merged 9a4c1af199a5

Original comment by oczk...@gmail.com on 29 Dec 2013 at 12:16