Browse Source

Remove extra spaces in file path

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

4
smart_service/apis/master_api.py

@ -455,14 +455,16 @@ 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']}';
''')

Loading…
Cancel
Save