So i am trying to take some code that i had working before and turn it into a function but every time i run my code it kicks it to line 9 in my code which is a continue statement and says the its not properly in the loop. I was wondering if someone could please explain to me where im goign wrong with this and how to fix it and if there are any other errors that would mess my code up.Any help would be greatly appriciated thank you.
def convertToSor(saleDate,Amount,Fname,Lname,Email,Franchise,osg,State,Postal,OrderID,DateAdded,EmailSource):
for row in cf1:
nr = newrow
nr[saleDate] = row['LastOrderDate'].strip()
nr[Amount] = row['LastOrderAmount'].strip()
nr[Fname] = row['FirstName'].strip()
nr[Lname] = row['LastName'].strip()
nr[Email] = row['EmailAddress'].strip().split(',',1)[0]
if nr[Email] == '':
continue
fr_name = row[Franchise].strip()
if fr_name in franchiseList:
nr[Franchise] = franchiseList[fr_name]['FRANCHISE Name'].strip()
if nr[Franchise] == 'IGNORE':
continue
nr[osg] = franchiseList[fr_name]['FRANCHISE Name - Directory'].strip()
if nr[osg] == '':
nr[osg] = 'shop'
else:
nr[Franchise] = 'SHOP'
nr[osg] = 'shop'
nr[State] = row['State'].strip()
nr[Postal] = row['ZIP'].strip()
nr[OrderID] = row['WEBID'].strip()
nr[DateAdded] = datetime.date.today().strftime('%m/%d/%Y')
nr[EmailSource] = 'FACTSauto'
ur = updaterow
ur[saleDate] = row['LastOrderDate'].strip()
ur[Amount] = row['LastOrderAmount'].strip()
ur[Fname] = row['FirstName'].strip()
ur[Lname] = row['LastName'].strip()
ur[Email] = row['EmailAddress'].strip().split(',',1)[0]
if ur[Email] == '':
continue
fr_name = row[Franchise].strip()
if fr_name in franchiseList:
ur[Franchise] = franchiseList[fr_name]['FRANCHISE Name'].strip()
if ur[Franchise] == 'IGNORE':
continue
ur[osg] = franchiseList[fr_name]['FRANCHISE Name - Directory'].strip()
if ur[osg] == '':
ur[osg] = 'shop'
else:
ur[Franchise] = 'SHOP'
ur[osg] = 'shop'
ur[State] = row['State'].strip()
ur[Postal] = row['ZIP'].strip()
ur[OrderID] = row['WEBID'].strip()
return True