Conversion blockchain error resolved
This commit is contained in:
parent
d06db439d9
commit
055b986145
|
@ -577,35 +577,36 @@ class Conversion:
|
||||||
scriptconversion["translated_scriptFile_path"] = translated_scripttt
|
scriptconversion["translated_scriptFile_path"] = translated_scripttt
|
||||||
print("blockchain script conversion 5")
|
print("blockchain script conversion 5")
|
||||||
|
|
||||||
print("audit blockchain")
|
if obj.converted_audit_id:
|
||||||
print("blockchain script conversion 5.1")
|
print("audit blockchain")
|
||||||
# blockchain upload of csv-json data
|
print("blockchain script conversion 5.1")
|
||||||
adit_id = obj.converted_audit_id
|
# blockchain upload of csv-json data
|
||||||
|
adit_id = obj.converted_audit_id
|
||||||
|
|
||||||
file_to_audit = File.objects.get(
|
file_to_audit = File.objects.get(
|
||||||
script=adit_id,
|
script=adit_id,
|
||||||
type="script-csv"
|
type="script-csv"
|
||||||
)
|
)
|
||||||
csv_script_path = file_to_audit.file.path
|
csv_script_path = file_to_audit.file.path
|
||||||
df = pd.read_csv(csv_script_path)
|
df = pd.read_csv(csv_script_path)
|
||||||
df = df.loc[:, ["content", "script_element"]]
|
df = df.loc[:, ["content", "script_element"]]
|
||||||
script_json: dict = json.loads(utilities.csv_to_json(df))
|
script_json: dict = json.loads(utilities.csv_to_json(df))
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
print("Temporary directory created:", temp_dir)
|
print("Temporary directory created:", temp_dir)
|
||||||
temp_filename = os.path.join(temp_dir, 'script_json_file.json')
|
temp_filename = os.path.join(temp_dir, 'script_json_file.json')
|
||||||
print(temp_filename)
|
print(temp_filename)
|
||||||
with open(temp_filename, 'w') as json_file:
|
with open(temp_filename, 'w') as json_file:
|
||||||
json.dump(script_json, json_file, indent=4)
|
json.dump(script_json, json_file, indent=4)
|
||||||
script_json = {}
|
script_json = {}
|
||||||
script_path1 = temp_filename
|
script_path1 = temp_filename
|
||||||
# script_size = file_to_audit_docx.file.size
|
# script_size = file_to_audit_docx.file.size
|
||||||
with open(script_path1, 'rb') as _file:
|
with open(script_path1, 'rb') as _file:
|
||||||
hash2 = uploadDataToIPFSNode(_file)
|
hash2 = uploadDataToIPFSNode(_file)
|
||||||
script_json["script_file_path"] = script_path1
|
script_json["script_file_path"] = script_path1
|
||||||
script_json["script_file"] = hash2
|
script_json["script_file"] = hash2
|
||||||
script_json["type"] = "script-json"
|
script_json["type"] = "script-json"
|
||||||
scriptconversion["script-json"] = script_json
|
scriptconversion["script-json"] = script_json
|
||||||
print("blockchain script conversion 5.2")
|
print("blockchain script conversion 5.2")
|
||||||
|
|
||||||
blockchain_obj = UserCredentialsForBlockchain.objects.get(user=self.user)
|
blockchain_obj = UserCredentialsForBlockchain.objects.get(user=self.user)
|
||||||
UserId = blockchain_obj.user_id
|
UserId = blockchain_obj.user_id
|
||||||
|
|
|
@ -632,12 +632,13 @@ def ScriptTranslation(*args, **kwargs):
|
||||||
audit.audit()
|
audit.audit()
|
||||||
status.status = "SUCCESS"
|
status.status = "SUCCESS"
|
||||||
status.save()
|
status.save()
|
||||||
|
print("----> Script id from conv-aud is here=", audit_id)
|
||||||
|
translation_instance.converted_audit_id = audit_id
|
||||||
|
translation_instance.save()
|
||||||
except:
|
except:
|
||||||
status.status = "FAILURE"
|
status.status = "FAILURE"
|
||||||
status.save()
|
status.save()
|
||||||
|
|
||||||
print("----> Script id from conv-aud is here=", audit_id)
|
|
||||||
translation_instance.converted_audit_id = audit_id
|
|
||||||
translation_instance.save()
|
|
||||||
sys.stdout = original_stdout
|
sys.stdout = original_stdout
|
||||||
return saveFile
|
return saveFile
|
Loading…
Reference in New Issue