diff options
-rwxr-xr-x | host/lib/ic_reg_maps/common.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/host/lib/ic_reg_maps/common.py b/host/lib/ic_reg_maps/common.py index 69a4b0b66..7e1eac086 100755 --- a/host/lib/ic_reg_maps/common.py +++ b/host/lib/ic_reg_maps/common.py @@ -178,4 +178,5 @@ def generate(name, regs_tmpl, body_tmpl='', file=__file__, append=False): ) #write the generated code to file specified by argv1 - open(sys.argv[1], 'a' if append else 'w').write(code) + with open(sys.argv[1], 'a' if append else 'w') as f: + f.write(code) |