Closed hyunjimoon closed 2 years ago
This is the issue we just discussed over email; Vengine 9.x sometimes gives that return code with cmd
scripts even when closing correctly. You need to change the line in the function run_vengine_script
where it checks the returncode
:
if proc.returncode != 1:
Change it to something like:
if not (proc.returncode == 0 or proc.returncode == 3221225477):
(This will preclude compatibility with Vengine 7.2; if you want that as well you need to allow proc.returncode == 1
to pass also.
Thanks! I noticed, but wanted to make a pull request with updated code :)
I've updated the automation example with the temporary fix, and it will also be incorporated into the main codebase which will hopefully be ready to test soon!
Another error code is discovered 3221226525. If I push the warning sign once, it disappears and run calibration correctly in the second attempt. This error does not happens everytime, but around once in five runs. I am using the updated version Tom shared with the following comment.
The expiration warning no longer uses a dialog. This means it's not visible unless you look in the .err log in %appdata%.
Running XPARALLEL
@tseyanglim do you know how to 1. turn off warning dialog and 2.run XPARALLEL?
Initialising <__main__.Script object at 0x00000130250F8640>
-----
Starting new log at Thu Oct 6 13:18:04 2022
Ready to work!
Initialising <__main__.Script object at 0x0000013025106950>
Initialising PrPr_main_opt!
Return code is 3221226525
Vensim! Trying again...
Payoff for PrPr_main_opt is -878.334, calibration complete!
Optimization complete - payoff is -878.334!
More work? Okay!
Initialising <__main__.RunScript object at 0x0000013025106950>
Traceback (most recent call last):
File "C:\Users\amoon\Dropbox\WINcode\VST\VST Automation\VST Automation Example v2.py", line 349, in <module>
compile_script(cf, RunScript, 'main', 'run', {}, logfile, chglist=[('main', 'opt')])
File "C:\Users\amoon\Dropbox\WINcode\VST\VST Automation\VST Automation Example v2.py", line 164, in compile_script
return mainscript.run_script(scriptname, controlfile, subdir, logfile)
File "C:\Users\amoon\Dropbox\WINcode\VST\VST Automation\VST Automation Example v2.py", line 116, in run_script
return run_vensim_script(scriptname, controlfile['vensimpath'], 10, logfile)
File "C:\Users\amoon\Dropbox\WINcode\VST\VST Automation\VST Automation Example v2.py", line 274, in run_vensim_script
subprocess.run(f"{vensimpath} \"./{scriptname}.cmd\"", check=True)
File "C:\Users\amoon\Miniconda3\envs\VST\lib\subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\amoon\Miniconda3\envs\VST\lib\subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\amoon\Miniconda3\envs\VST\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 87] The parameter is incorrect
Process finished with exit code 1
Hi when I run the last block of your jupyter file, I face the following error and the calibration doesn't stop: