mirror of https://gitlab.com/bashrc2/epicyon
Don't try to save if filename too long
parent
ccc4759b10
commit
edd6298fa7
7
utils.py
7
utils.py
|
@ -1215,9 +1215,12 @@ def save_json(json_object: {}, filename: str) -> bool:
|
||||||
with open(filename, 'w+', encoding='utf-8') as json_file:
|
with open(filename, 'w+', encoding='utf-8') as json_file:
|
||||||
json_file.write(json.dumps(json_object))
|
json_file.write(json.dumps(json_object))
|
||||||
return True
|
return True
|
||||||
except OSError as ex:
|
except OSError as exc:
|
||||||
print('EX: save_json ' + str(tries) + ' ' + str(filename) +
|
print('EX: save_json ' + str(tries) + ' ' + str(filename) +
|
||||||
' ' + str(ex))
|
' ' + str(exc))
|
||||||
|
if exc.errno == 36:
|
||||||
|
# filename too long
|
||||||
|
break
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
tries += 1
|
tries += 1
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue