Visual Studio AddPropertySheet Type Error
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
When trying to add a style sheet to a visual studio C++ project using pythoncom, the following error occurs
Traceback (most recent call last):
File "test.py", line 87, in <module>
proj.addPropertySheet("d:\\temp\\vs\\boost.props")
File "test.py", line 34, in addPropertySheet
sheet = conf.AddPropertySheet(file)
File "C:\Python27\lib\site-packages\win32com\gen_py\0CD36BB6-D828-4DB9-91BF-AD493EE76B79x0x10x0\VCConfiguration.py", line 35, in AddPropertySheet
ret = self._oleobj_.InvokeTypes(782, LCID, 1, (9, 0), ((31, 1),),FileName
TypeError: The VARIANT type is unknown (0x0000001f)
Source is attached.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Old Bugs - new issues at https://github.com/mhammond/pywin32/issues"
Source highlighting issue
31 is VT_LPWSTR, which is not valid in a VARIANT. This looks like a bug in the typelib. If you edit the generated file and change it to VT_BSTR (8)
does it succeed ?
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Old Bugs - new issues at https://github.com/mhammond/pywin32/issues"
Changing to VT_BSTR(8) results in a different error
Traceback (most recent call last):
File "test.py", line 87, in <module>
proj.addPropertySheet("d:\\temp\\vs\\boost.props")
File "test.py", line 34, in addPropertySheet
sheet = conf.AddPropertySheet(file)
File "C:\Python27\lib\site-packages\win32com\gen_py\0CD36BB6-D828-4DB9-91BF-AD493EE76B79x0x10x0\VCConfiguration.py", line 35, in AddPropertySheet
ret = self._oleobj_.InvokeTypes(782, LCID, 1, (9, 0), ((8, 1),),FileName
pywintypes.com_error: (-2147352568, 'Bad variable type.', None, None)
Could you try passing win32com.client.VARIANT(pythoncom.VT_LPWSTR, "the string") and see if that helps?
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Old Bugs - new issues at https://github.com/mhammond/pywin32/issues"
Passing the variant as suggested results in the original error
TypeError: The VARIANT type is unknown (0x0000001f)