Python-zeep: 'Sequence' object has no attribute '_require_keyword_arg'

Created on 17 Jun 2016  路  9Comments  路  Source: mvantellingen/python-zeep

Hello! Continued my development and found another issue for the "Set" operation in the same wsdl I provided.

Code as following:

motype = 'EPSMultiSC@http://schemas.example.com/ma/HSS/'
moid = {'imsi': imsi}
moattr = {'SetEPSMultiSC': {'epsOdb': 'ODB-ALL'}}
mesg = soapclient.service._binding.create_message('Set', motype, moid, moattr, _soapheader=sessionid)
response = soapclient.service.Set(motype, moid, moattr, _soapheader = sessionid)

Error gives out:

Traceback (most recent call last):
  File "test1.py", line 136, in epsmultisc_set
    response = soapclient.service.Set(motype, moid, moattr, _soapheader = sessionid)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/client.py", line 23, in __call__
    self._proxy._client, self._op_name, args, kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/wsdl/definitions.py", line 292, in send
    client, self.binding_options, operation, args, kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/wsdl/soap.py", line 79, in send
    serialized = operation_obj.create(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/wsdl/definitions.py", line 245, in create
    return self.input.serialize(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/wsdl/messages.py", line 75, in serialize
    body_value = self.body(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/elements.py", line 88, in __call__
    instance = self.type(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/types.py", line 137, in __call__
    return self._value_class(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/valueobjects.py", line 41, in __init__
    value = _convert_value(field, value)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/valueobjects.py", line 244, in _convert_value
    value = field(**value)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/elements.py", line 88, in __call__
    instance = self.type(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/types.py", line 137, in __call__
    return self._value_class(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/valueobjects.py", line 35, in __init__
    items = _process_signature(fields, args, kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/valueobjects.py", line 96, in _process_signature
    if element._require_keyword_arg:
AttributeError: 'Sequence' object has no attribute '_require_keyword_arg'

The wsdl and xsd are the same as in issue 74

bug componenxsd requirefeedback

All 9 comments

Hi!

Tried again with the modification, but got following errors:

Traceback (most recent call last):
  File "test1.py", line 133, in epsmultisc_set
    mesg = soapclient.service._binding.create_message('Set', motype, moid, moattr, _soapheader=sessionid)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/wsdl/soap.py", line 56, in create_message
    serialized = operation.create(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/wsdl/definitions.py", line 245, in create
    return self.input.serialize(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/wsdl/messages.py", line 75, in serialize
    body_value = self.body(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/elements.py", line 88, in __call__
    instance = self.type(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/types.py", line 137, in __call__
    return self._value_class(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/valueobjects.py", line 41, in __init__
    value = _convert_value(field, value)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/valueobjects.py", line 244, in _convert_value
    value = field(**value)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/elements.py", line 88, in __call__
    instance = self.type(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/types.py", line 137, in __call__
    return self._value_class(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/valueobjects.py", line 35, in __init__
    items = _process_signature(fields, args, kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.10.0.dev0-py2.7.egg/zeep/xsd/valueobjects.py", line 138, in _process_signature
    ) % (next(six.iterkeys(kwargs)), ', '.join(x[0] for x in all_fields)))
TypeError: __init__() got an unexpected keyword argument 'imsi', Valid keyword arguments are: sequence

Ok, sorry for this again. Seems you are using a wsdl which resolves around xsd items which aren't tested that good yet. I'll dive into this later

Hello! Any updates on this? Or shall I open a new one for better tracking? Thanks!

Completely forgot about it :), re-openend

Small update: The issue is caused by a double nested sequence element (.. in the xsd). This is actually allowed and I' currently refactoring a lot of stuff to support this but in the meantime if you can edit the xsd's and remove the in this case unnecessary double nesting then it should work for now.

hi @dddtc2005, I've just finished the refactoring of the xsd processing to handle this case. Can you test #101 for me? It still needs some minor cleanup, docstrins etc before I merge it to master. But I appreciate it if you could let me know if the PR solves your issue

Sure, I will have a try and let you know later

FYI; I just merged that branch to master, so if you could give the master branch a try that would be great 馃憤

I'll close it for now, let me know if you still have issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  6Comments

ameenaskar picture ameenaskar  路  4Comments

olivierverville picture olivierverville  路  3Comments

majackson picture majackson  路  6Comments

dhinchakdhoom picture dhinchakdhoom  路  4Comments