com_error功能不在pythoncom中

发布于 2025-02-13 05:32:25 字数 461 浏览 0 评论 0原文

我正在研究一个我们将Aspen Plus与Python联系起来的项目,因此我们可以应用强化学习代理人设计和优化分离列车。同时,已经解决了许多错误,但目前我对以下错误感到疑惑: pywintypes.com_error:(-2147352567,“异常发生”

。错误,但是com_errors在常规上不能截获,除非语句。 在线我找到了使用以下语句的解决方案:

try:
   ...
except pythoncom.com_error:
...

此语句似乎对我不起作用,因为我会收到警告: 在“ pythoncom.py”中找不到参考“ com_error”,

有人有一个想法解决这个问题吗? 帮助您非常感谢! 在此处输入图像描述

I am working on a project in which we link Aspen Plus to Python, so we can apply a reinforcement learning agent to design and optimize a separation train. Meanwhile a lot of errors have been fixed, but currently I am stuc on the following error:
pywintypes.com_error: (-2147352567, 'Exception occurred.', (1, 'Aspen.Unknown', 'No message available', None, 0, 0), None)

I tried to use a try and except statement to intercept this error, but com_errors are not interceptable in regular except statements.
Online I found solutions which use the following statement:

try:
   ...
except pythoncom.com_error:
...

This statement does not seem to work for me, since I get a warning:
Cannot find reference 'com_error' in 'pythoncom.py'

Does anyone has an idea to solve this?
Help is much appreciated!
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文