My python program uses pythoncom (pythoncomxx.dll). I am sometimes getting a 'com_error' exception (which is fine) and I would like to catch it in an exception handler.
But when I try to do the following, the compiler complains that 'com_error' is unknown.
try:
self.session.findById(tree_id).expandNode(node_id)
except com_error:
print_exc()
I added the following to my imports, but this doesn't help: the statement 'from pythoncom import com_error' shows 'com_error' underlined in red
import pythoncom
import win32com.client
import time
from traceback import print_exc
from pythoncom import com_error
The 'solution' is to catch just all exceptions, but i want to catch only this one. How can I make the 'com_error' known to the program?
Thanks!