Skip to content

ARBSubscriptionType issue with Python 3.8 #145

Description

@countach74

When updating from Python 3.7 => 3.8, I've started to receive the following complaint from Authorize.net / PyXB:

TypeError: function takes 3 arguments plus optional tzinfo (8 given)
  File "authorizenet/apicontrollersbase.py", line 134, in execute
    xmlRequest = self.buildrequest()
  File "authorizenet/apicontrollersbase.py", line 105, in buildrequest
    xmlRequest = self._request.toxml(encoding=constants.xml_encoding, element_name=self.getrequesttype())
  File "pyxb/binding/basis.py", line 555, in toxml
    dom = self.toDOM(bds, element_name=element_name)
  File "pyxb/binding/basis.py", line 527, in toDOM
    self._toDOM_csc(bds, element)
  File "pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "pyxb/binding/basis.py", line 1119, in _toDOM_csc
    dom_support.appendTextChild(self, parent)
  File "pyxb/utils/domutils.py", line 584, in appendTextChild
    return parent.appendChild(self.document().createTextNode(self.valueAsText(text)))
  File "pyxb/utils/domutils.py", line 402, in valueAsText
    return value.xsdLiteral()
  File "pyxb/binding/basis.py", line 992, in xsdLiteral
    return self.XsdLiteral(self)
  File "pyxb/binding/datatypes.py", line 738, in XsdLiteral
    value += datetime.timedelta(minutes=cls.__MinutesPerHalfDay)
  File "pyxb/binding/datatypes.py", line 662, in __new__
    raise TypeError('function takes %d arguments plus optional tzinfo (%d given)' % (len(cls._ValidFields), len(args)))

It seems to be related to the paymentScheduleType.startDate property. I've tried setting it to a pyxb date, a python datetime.date, and a string. None of these work. And if I roll back to Python 3.7, the issue goes away. Any thoughts or suggestions? Is this a mistake on my end?

Activity

  1. AntonDeMeester commented on Mar 16, 2020

    @AntonDeMeester

    I've encoutered the same problem. I've created an issue directly on PyXB and also found an temporary solution: pabigot/pyxb#123

  2. Sharpienero commented on Jun 3, 2021

    @Sharpienero

    Reproducable in 3.9.

    I've tried many things, including @AntonDeMeester's solution but nothing is working. Any help would be greatly appreciated as this is holding up a production release.

  3. countach74 commented on Jun 4, 2021

    @countach74
    Author

    I'm pretty sure I found a solution but for the life of me I actually can't find what it was. Been so long ago now, I can't even remember what project I ran into this on.

  4. Sharpienero commented on Jun 4, 2021

    @Sharpienero

    I'm pretty sure I found a solution but for the life of me I actually can't find what it was. Been so long ago now, I can't even remember what project I ran into this on.

    The solution above by @AntonDeMeester did end up working with 3.9. Just had to set startDate = customdate(datetime object) and it ended up posting the ARB correctly.

    This is a clear issue with pyxb and Authorize.net, but I don't see any real resolution coming for this. Shame, really.

    Thanks for everyone's help.

  5. Sharpienero commented on Oct 18, 2023

    @Sharpienero

    @anmolmonga-kiwi Are you sure? I use this solution on 3.10.

  6. dhanashreeyadav1 commented on Sep 30, 2024

    @dhanashreeyadav1

    TCS-Dev Dhanashree- If I try to execute the file, I am not able to reproduce the error because we have replaced the offending serialization library with a newer one, which will hopefully not cause more issues like this.

    This issue has been fixed in v1.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions