I am workign with a xml file that contains the order information for a company. What i am tryign to do is see if the xml file have a scan code in it and if it does then to pull the order number so that it can be passed to another function. I have a base start but I keep getting the error AttributeError: 'NoneType' object has no attribute 'text' and dont know how to fix it. Could someone explain to me what im doign wrong and how to fix my code.
tree = ET.ElementTree(file=args.destDir + '/' + 'FACTSentered'+args.fileDate+'.xml')
root=tree.getroot()
codeList = root.findall(".//ScanCodes/ScanCode/Code")
code_stats = {}
for el in codeList:
#order = el.find('OrderNumber').text
code = el.find('Code').text
user = el.find('User').text
if user is None:
user = '??'
seq = el.find('SeqNumber').text
#print order
print code
print user
print seq