From: Luke Kenneth Casson Leighton Date: Fri, 24 Jul 2020 10:54:24 +0000 (+0100) Subject: read into a BytesIO to avoid "too many open files" X-Git-Tag: semi_working_ecp5~583 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=75858e9e95e25f882fa130f50778f18fe88aa742;p=soc.git read into a BytesIO to avoid "too many open files" see https://bugs.libre-soc.org/show_bug.cgi?id=438 --- diff --git a/src/soc/simulator/program.py b/src/soc/simulator/program.py index fda0c959..d77f9d78 100644 --- a/src/soc/simulator/program.py +++ b/src/soc/simulator/program.py @@ -27,7 +27,10 @@ class Program: self.obj_fmt = "-le" if isinstance(instructions, str): # filename - self.binfile = open(instructions, "rb") + # read instructions into a BytesIO to avoid "too many open files" + with open(instructions, "rb") as f: + b = f.read() + self.binfile = BytesIO(b, 'rb') self.assembly = '' # noo disassemble number fiiive print("program", self.binfile) else: