【发布时间】:2023-04-05 21:56:01
【问题描述】:
是否有可能在我需要的地方暂停/恢复嵌入式 python 解释器的工作?例如:
C++伪代码部分:
main()
{
script = "python_script.py";
...
RunScript(script); //-- python script runs till the command 'stop'
while(true)
{
//... read values from some variables in python-script
//... do some work ...
//... write new value to some other variables in python-script
ResumeScript(script); //-- python script resumes it's work where
// it was stopped. Not from begin!
}
...
}
Python脚本伪代码部分:
#... do some init-work
while true:
#... do some work
stop # - here script stops and C++-function RunScript()
# returns control to C++-part
#... After calling C++-function ResumeScript
# the work continues from this line
这可能与 Python/C API 相关吗?
谢谢
【问题讨论】:
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:暂停/恢复嵌入式 python 解释器 - Python技术站