Odd COM problems with VC

jim_kerr at my-deja.com jim_kerr at my-deja.com
Wed Mar 8 15:22:37 EST 2000


  I'm trying to use Python's COM facilities to
control a build in Visual C++.
I've run into some problems that don't make sense
to me at all (not surprising,
since I don't know COM).

  Here's the script I have so far:

     # Open and manipulate a Visual C++ project

     from win32com.client import Dispatch
     vc=Dispatch("MSDEV.Application")
     vc.Visible=1
     vc.Documents.Open(r"C:\src\Workspace.dsw")
     projlist = vc.Projects
     ap = vc.ActiveProject()

  So far, so good; ap has the value 'MainApp', as
it should. But if I
try to set the active project (from PythonWin)

    >>> vc.ActiveProject = 'Persist'

... it doesn't fly:

Traceback (innermost last):
  File "<interactive input>", line 1, in ?
  File "C:\Program
Files\Python\win32com\client\dynamic.py", line
413, in __setattr__
    self._oleobj_.Invoke(self._olerepr_.propMap
[attr].dispid, 0, pythoncom.DISPATCH_PROPERTYPUT,
0, value)
com_error: (-2147352567, 'Exception occurred.',
(61837, 'Microsoft Visual C++', 'Unable to write
read-only property.', 'C:\\PROGRA~1\\MICROS~3
\\COMMON\\MSDEV98\\BIN\\MSDEV.HLP', 455053, 0),
None)

  The MSDEV documentation sure implies that
ActiveProject is writable, so this
error seems kind of confusing.

  So anyway, I'm doing something wrong... I can
accept that. But here's the odd thing:
from this point on, no matter what I type at the
PythonWin prompt, a dialog appears
that says:

  'The topic does not exist. Contact your
application vendor for an updated
   Help file (129)'

  The only cure that I've found for this is to
quit and restart PythonWin.

  Has anyone out there slayed these dragons
before?

  FWIW, here are some OS and Python specifics:
    NT 4.0, Service Pack 5
    PythonWin build 125

  Thanks for the help!

-Jim


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list