Browse Source

Remove extra spaces in file path

master
venkataakhil 1 year ago
parent
commit
a2b0254ff6
  1. 6
      smart_service/apis/master_api.py

6
smart_service/apis/master_api.py

@ -455,15 +455,17 @@ def file_not_exists():
pass
def remove_extra_spacces_in_file_path():
def remove_extra_spaces_in_file_path():
import re
file_path_not_exists = base_path + "/files/json_files/1.json"
with open(file_path_not_exists, 'r') as outfile:
data = json.load(outfile)
for d in data:
res_str = re.sub("/files/ /", "/files/", d['file'])
res_str = re.sub("/files/ ", "/files/", res_str)
print(res_str)
frappe.db.sql(f'''
update tabProcedure_Details set file = '{res_str}' where name = '{d['name']}';
''')
frappe.db.commit()
frappe.db.commit()
Loading…
Cancel
Save