简体   繁体   English

我该如何尝试,除了:阻止此错误?

[英]How do I make a try, except: block for this error?

Whenever Photoshop does not have a document open, I get this error:每当 Photoshop 没有打开文档时,我都会收到此错误:

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Adobe Photoshop', 'No such element', None, 0, -2147352565), None)

which is PERFECTLY FINE: all I need to do is make a这非常好:我需要做的就是做一个

try:

except:

block.堵塞。 However, I cannot except the error.但是,我不能排除错误。 I tried writing我试着写

except pywintypes.com_error:

however that did not work.然而这并没有奏效。 So, how do I import the error into my py file?那么,如何将错误导入到我的 py 文件中?

EDIT::编辑::

I fixed it by typing我通过输入修复它

from pywintypes import com_error

我通过键入以下内容修复了它:

from pywintypes import com_error

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM