mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-01-23 14:50:54 +01:00
Try closing the config file explicitly, to avoid null byte errors
This commit is contained in:
parent
45f99ab48a
commit
8618708fd1
@ -158,8 +158,12 @@ def setConfig(config):
|
|||||||
|
|
||||||
config = commented_config
|
config = commented_config
|
||||||
yaml.indent(mapping=2, sequence=4, offset=2)
|
yaml.indent(mapping=2, sequence=4, offset=2)
|
||||||
with open(config_yaml_path, "w", encoding="utf-8") as f:
|
|
||||||
|
try:
|
||||||
|
f = open(config_yaml_path, "w", encoding="utf-8")
|
||||||
yaml.dump(config, f)
|
yaml.dump(config, f)
|
||||||
|
finally:
|
||||||
|
f.close() # do this explicitly to avoid NUL bytes (rare bug when using 'with')
|
||||||
except:
|
except:
|
||||||
log.error(traceback.format_exc())
|
log.error(traceback.format_exc())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user