如何解决为什么 Oct2Py 会话死了?
我在 Oc2py 中使用 dynare 运行来自 Galí-Monacelli (2005) 的代码并且会话终止。
我尝试从 oc2py 运行 driver.m,但出现相同的错误。然后我更改了 timeout = None 和 timeout = 1e6 并且问题仍然存在。如果我运行像 Galí (2008) 这样的简单代码就没有问题。
代码从 Octave 运行良好。 任何帮助表示赞赏。这里的错误:
OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "org.octave.OctClassLoader"). To use archived non-system classes,this property must be not be set
Using 64-bit preprocessor
Starting Dynare (version 4.6.0).
Calling Dynare with arguments: none
Starting preprocessing of the model file ...
Found 19 equation(s).
Evaluating expressions...done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 2).
Processing outputs ...
done
Preprocessing completed.
---------------------------------------------------------------------------
EOF Traceback (most recent call last)
~/miniconda3/lib/python3.9/site-packages/oct2py/core.py in _feval(self,func_name,func_args,dname,nout,timeout,stream_handler,store_as,plot_dir)
562 try:
--> 563 engine.eval('_pyeval("%s","%s");' % (out_file,in_file),564 timeout=timeout)
~/miniconda3/lib/python3.9/site-packages/octave_kernel/kernel.py in eval(self,code,silent)
246 else:
--> 247 raise e
248
~/miniconda3/lib/python3.9/site-packages/octave_kernel/kernel.py in eval(self,silent)
231 try:
--> 232 resp = self.repl.run_command(code.rstrip(),233 timeout=timeout,~/miniconda3/lib/python3.9/site-packages/Metakernel/replwrap.py in run_command(self,command,line_handler,stdin_handler)
241 # Command was fully submitted,Now wait for the next prompt
--> 242 if self._expect_prompt(timeout=timeout) == 1:
243 # We got the continuation prompt - command was incomplete
~/miniconda3/lib/python3.9/site-packages/Metakernel/replwrap.py in _expect_prompt(self,timeout)
130 while True:
--> 131 pos = self.child.expect(expects,timeout=timeout)
132 # got a full prompt or continuation prompt.
~/miniconda3/lib/python3.9/site-packages/pexpect/spawnbase.py in expect(self,pattern,searchwindowsize,async_,**kw)
342 compiled_pattern_list = self.compile_pattern_list(pattern)
--> 343 return self.expect_list(compiled_pattern_list,344 timeout,async_)
~/miniconda3/lib/python3.9/site-packages/pexpect/spawnbase.py in expect_list(self,pattern_list,**kw)
371 else:
--> 372 return exp.expect_loop(timeout)
373
~/miniconda3/lib/python3.9/site-packages/pexpect/expect.py in expect_loop(self,timeout)
178 except EOF as e:
--> 179 return self.eof(e)
180 except TIMEOUT as e:
~/miniconda3/lib/python3.9/site-packages/pexpect/expect.py in eof(self,err)
121 exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
--> 122 raise exc
123
EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f481c7a8100>
command: /usr/bin/octave-cli
args: [b'/usr/bin/octave-cli',b'--interactive',b'--quiet',b'--no-init-file']
buffer (last 100 chars): ''
before (last 100 chars): ''
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 20935
child_fd: 74
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: None
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile('PEXPECT_PROMPT>')
1: re.compile('PEXPECT_PROMPT_')
2: re.compile('\\A.+?__stdin_prompt>|debug> ')
3: re.compile('\r\n')
During handling of the above exception,another exception occurred:
Oct2PyError Traceback (most recent call last)
<ipython-input-39-d8af0fd933a9> in <module>
----> 1 run_model()
<ipython-input-38-9461382384fc> in run_model()
1 def run_model():
2 oc = Oct2Py(timeout = None);
----> 3 oc.dynare('gali3.mod',timeout = None);
4 return df
~/miniconda3/lib/python3.9/site-packages/oct2py/dynamic.py in __call__(self,*inputs,**kwargs)
94 for item in pair)
95
---> 96 return self._ref().feval(self.name,**kwargs)
97
98 def __repr__(self):
~/miniconda3/lib/python3.9/site-packages/oct2py/core.py in feval(self,func_path,*func_args,**kwargs)
378 stream_handler = self.logger.info if verbose else self.logger.debug
379
--> 380 return self._feval(func_name,dname=dname,nout=nout,381 timeout=timeout,stream_handler=stream_handler,382 store_as=store_as,plot_dir=plot_dir)
~/miniconda3/lib/python3.9/site-packages/oct2py/core.py in _feval(self,plot_dir)
574 stream_handler(engine.repl.child.before)
575 self.restart()
--> 576 raise Oct2PyError('Session died,restarting')
577
578 # Read in the output.
Oct2PyError: Session died,restarting
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。