User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.
Whenever "answer" is having pipe delimiters in them, the files are getting corrupted and the record is not getting appended and further functionalities are disabling themselves.
@app.route("/append_record", methods =['POST'])def append_record():query= text_normalize_csv_diacritic(request.json["query"])#print query
answer = text_normalize_csv_diacritic(request.json["answer"])#print answermodule= request.json["module"]
lang = request.json["lang"]
isloop = request.json["is_loop"]
csv_file = getfilefromdb(lang)#print csv_file.read()
found =False
questions=[]
corpus =[]
lang_query= detect_language(query)
lang_query_alt = detect_language(answer)#csv_file_r = csv.reader(csv_file.split('\n'), quotechar='"')
csv_file_r = csv.reader(csv_file.splitlines(), quotechar='"')#print csv_file.read().splitlines()
corpus = list(csv_file_r)#print corpusif lang_query_alt == lang_queryand lang == lang_query:for t in corpus[1:]:try:if len(t)>1:
questions.append(t[0])#print questionsexceptExceptionas e:return jsonify(error=str(e))ifquerynotin questions:
corpus.append([query, answer,module, isloop])else:index= questions.index(query)index+=1if corpus[index][1]== answer:return jsonify(error="already exists")else:
corpus[index][1]= answer
#print "\n".join(",".join(corpora).decode("utf-8","ignore") for corpora in corpus)else:return jsonify(error="Please make sure that you have selected your language appropriately")try:
putfileindb("\n"
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
3 years ago
Whenever "answer" is having pipe delimiters in them, the files are getting corrupted and the record is not getting appended and further functionalities are disabling themselves.