python-fedex-devs/python-fedex

TypeError: unsupported operand type(s)

Closed this issue · 0 comments

Error:
Traceback (most recent call last):
File "path/PycharmProjects/Fedex_Autofill/src/Autofill.py", line 67, in
shipment.add_package(package1)
File "path\PycharmProjects\Fedex_Autofill\venv\lib\site-packages\fedex\services\ship_service.py", line 163, in add_package
self.RequestedShipment.TotalWeight.Value += package_weight
TypeError: unsupported operand type(s) for +=: 'float' and 'NoneType'

Code:
package1 = shipment.create_wsdl_object_of_type('RequestedPackageLineItem')
package1_weight = shipment.create_wsdl_object_of_type('Weight')
package1_weight.Value = 5.0
package1_weight.Units = "LB"
package1.PhysicalPackaging = 'Fedex Box'
package1.weight = package1_weight
shipment.add_package(package1)