#621 Visual Studio AddPropertySheet Type Error

open
nobody
com (105)
5
2012-11-19
2012-11-19
Anonymous
No

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.

Discussion


  • Anonymous
    2012-11-19

    Source highlighting issue

     
    Attachments
  • Roger Upole
    Roger Upole
    2012-11-19

    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 ?

     

  • Anonymous
    2012-11-21

    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)

     
  • Mark Hammond
    Mark Hammond
    2012-11-24

    Could you try passing win32com.client.VARIANT(pythoncom.VT_LPWSTR, "the string") and see if that helps?

     

  • Anonymous
    2012-11-27

    Passing the variant as suggested results in the original error

    TypeError: The VARIANT type is unknown (0x0000001f)