Lukas Kawalec
Lukas Kawalec

Reputation: 133

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

Upvotes: 0

Views: 133

Answers (1)

Lukas Kawalec
Lukas Kawalec

Reputation: 133

I fixed it by typing this:

from pywintypes import com_error

Upvotes: 1

Related Questions