I have this code to open an Inventor File Dialog. It was working a OK yesterday and does not work today.
import win32com.client
def TestFileDialog():
ThisApp = win32com.client.Dispatch("Inventor.Application")
oFileDlg = ThisApp.CreateFileDialog()
oFileDlg.Filter = "Inventor Files (*.iam;*.ipt) #|*.iam;*.ipt|All Files (*.*)|*.*"
oFileDlg.FilterIndex = 1
oFileDlg.DialogTitle = "Open File Test"
oFileDlg.InitialDirectory = "C:\\Users\\logig\\MoldTools"
oFileDlg.ShowOpen()
TestFileDialog()
Running the code on the interactive window of VS 2017 I get the following exception:
---------------------------------------------------------------------------
com_error Traceback (most recent call last)
<ipython-input-1-b46d3a85376d> in <module>()
11 oFileDlg.ShowOpen()
12
---> 13 TestFileDialog()
14
<ipython-input-1-b46d3a85376d> in TestFileDialog()
9 oFileDlg.DialogTitle = "Open File Test"
10 oFileDlg.InitialDirectory = "C:\\Users\\logig\\MoldTools"
---> 11 oFileDlg.ShowOpen()
12
13 TestFileDialog()
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\win32com\client\dynamic.py in ShowOpen(self)
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
The same code was running no problem yesterday. The directory exists, there are files with those extensions... I am totally lost about what could have changed. Will appreciate your help.