The function Session.Component returns a generic object of type IDSSComponent, how do 
you cast it to a different type.
In VB they use AS, but I don't see anything like AS in python.


VB code 

Dim Source As IDSSSource
Dim Search As IDSSSearch
Set Source = Session.Component(DssRoleObjectSource)
Set Search = Source.NewObject(DssTypeSearch)


Python code

Source = Session.Component(win32com.client.constants.DssRoleObjectSource)
Search = Source.NewObject(win32com.client.constants.DssTypeSearch)


Python output

File "C:\cvs\DSS_PY\test.py", line 24, in ?
    Search = Source.NewObject(win32com.client.constants.DssTypeSearch)
File "c:\program files\python20\win32com\client\__init__.py", line 339, in __getattr__
    raise AttributeError, attr
AttributeError: NewObject
========== Python debug run finished. ==========


I have tried

Source = Session.Component(win32com.client.constants.DssRoleObjectSource)
Source.__class__ = IDSSSource
Search = Source.NewObject(win32com.client.constants.DssTypeSearch


Python output

File "C:\cvs\DSS_PY\test.py", line 24, in ?
    Source.__class__ = IDSSSource
NameError: There is no variable named 'IDSSSource'
========== Python debug run finished. ==========
CONFIDENTIALITY NOTE:  This e-mail message, including any attachment(s), contains 
information that may be confidential, protected by the attorney-client or other legal 
privileges, and/or proprietary non-public information.  If you are not an intended 
recipient of this message or an authorized assistant to an intended recipient, please 
notify the sender by replying to this message and then delete it from your system.  
Use, dissemination, distribution, or reproduction of this message and/or any of its 
attachments (if any) by unintended recipients is not authorized and may be unlawful.

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to