Jun-26-2018, 09:48 AM
I am attempting to take a csv file containing test results for products and filtering the results so that I know what product was tested and its serial number.
Each product has 5-10 tests run on it so i have to first eliminate all duplicates.
Any idea what my pop error is? Is the function obsolete ?
I am also aware that this is probably not the best way of conducting this search and am not certain that it will work ( as have not tested fully due to the pop error.) Any prompts on future errors i might find would be appreciated.
Each product has 5-10 tests run on it so i have to first eliminate all duplicates.
@upload_csv_blueprint.route('/upload_csv', methods=['GET','POST']) @login_required def upload_file(): if request.method == 'POST': csvfile = request.files['file'] s_n_bank = [] main_bank = [] p_n_bank = [] reader = csv.DictReader(csvfile) for row in reader: temp_s_n=str(row['product_serial_number']) if temp_s_n not in s_n_bank: # Filters the serial s_n_bank.append(temp_s_n) # numbers so no sorted_bank= s_n_bank.sort() # duplicates. single_entry= sorted_bank.pop() # Does not recognise .pop() # attempting to use the refined serial number list to extract the relevant part number. #( UNTESTED ->) for row in reader: selected_entry= row.index(single_entry) temp_p_n = str(selected_entry['part_number']) if temp_p_n not in p_n_bank: p_n_bank.append(temp_p_n) main_bank.append(p_n_bank) main_bank.append(single_entry) p_n_bank.remove(temp_p_n) print main_bankI have the error message - AttributeError: 'NoneType' object has no attribute 'pop'.
Any idea what my pop error is? Is the function obsolete ?
I am also aware that this is probably not the best way of conducting this search and am not certain that it will work ( as have not tested fully due to the pop error.) Any prompts on future errors i might find would be appreciated.