简体   繁体   中英

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

Whenever Photoshop does not have a document open, I get this error:

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?

EDIT::

I fixed it by typing

from pywintypes import com_error

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

from pywintypes import com_error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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