Python: Multiprocessing - Suds - _pickle.PicklingError: Can't pickle <class> attribute lookup failed
Question: I'm making SOAP WSDL connection and then I want to run function in another
procces (threading is not suitable)

    
    
    from suds.client import Client
    
    class dTest:
    
    def setup(self, client):
        ws = Client("http://localhost?wsdl")
    
        # then I use some SOAP API methods and return dictionary with results
        return result_dict
    
    
    def test(self, name):
        # in this function I use another SOAP API methods
        return
    
    def main(self, client):
    
        result_dict = self.setup(client)
    
        for  name, num in result_dict.items():
            p = multiprocessing.Process(target=self.test, args=[name])
            p.start() # <- on this line I have an error
            p.join(timeout)
            if p.is_alive():
                p.terminate
    

Then I have an error

    
    
    File "D:\IPWStest\test\dTest.py", line 318, in main
        p.start()
      File "C:\Python34\lib\multiprocessing\process.py", line 105, in start
        self._popen = self._Popen(self)
      File "C:\Python34\lib\multiprocessing\context.py", line 212, in _Popen
        return _default_context.get_context().Process._Popen(process_obj)
      File "C:\Python34\lib\multiprocessing\context.py", line 313, in _Popen
        return Popen(process_obj)
      File "C:\Python34\lib\multiprocessing\popen_spawn_win32.py", line 66, in __init__
        reduction.dump(process_obj, to_child)
      File "C:\Python34\lib\multiprocessing\reduction.py", line 59, in dump
        ForkingPickler(file, protocol).dump(obj)
    _pickle.PicklingError: Can't pickle <class 'suds.sudsobject.UserCredentialsType'>: attribute lookup UserCredentialsType on suds.sudsobject failed               
    

I can't find any solution for this issue. How can I pickle this line?

> result_dict = self.setup(client)

Is another decision may be exist? Can anyone help me? What does this error
means?


Answer: Problem was in `setup` function. Web-service connection `ws` in setup uses in
`test` function. That's why this object cann't be pickle. If you using
`multiprocessing` and `suds` or any similar lib, new connection should be
created in every new process.

