Add closure
This commit is contained in:
@@ -13,11 +13,6 @@ def _verify_platform():
|
||||
raise Exception(f'Platform {_platform} unsupported (not yet)')
|
||||
|
||||
|
||||
def _check(result):
|
||||
if result != 0:
|
||||
raise Exception("Failed to read output {name}")
|
||||
|
||||
|
||||
# readable True => json, False => binary output
|
||||
def run_project(name: str, readable: bool = True) -> str:
|
||||
if not project.have_project(name):
|
||||
@@ -34,7 +29,7 @@ def run_project(name: str, readable: bool = True) -> str:
|
||||
rpt = os.path.join(os.path.join(dir, 'temp'), input + '.rpt')
|
||||
opt = os.path.join(os.path.join(dir, 'temp'), input + '.opt')
|
||||
command = f'{exe} {inp} {rpt} {opt}'
|
||||
#print(command)
|
||||
|
||||
result = os.system(command)
|
||||
if result != 0:
|
||||
raise Exception("Failed to run simulation for project {name}")
|
||||
@@ -43,12 +38,14 @@ def run_project(name: str, readable: bool = True) -> str:
|
||||
|
||||
handle = ctypes.c_void_p()
|
||||
|
||||
def _check(result):
|
||||
if result != 0:
|
||||
raise Exception(f'Failed to read output {name}')
|
||||
|
||||
_check(_lib_output.ENR_init(ctypes.byref(handle)))
|
||||
|
||||
_check(_lib_output.ENR_open(handle, ctypes.c_char_p(opt.encode())))
|
||||
|
||||
|
||||
|
||||
_check(_lib_output.ENR_close(ctypes.byref(handle)))
|
||||
|
||||
return ''
|
||||
|
||||
Reference in New Issue
Block a user