Boingo wrote: > Hello there, > > I am a bit new to PyWin32, but not new to Python. I am new to the COM > object I am trying to work with though. I have code that works in VB > to access a COM object, but similar code in Python is not working. I > am pretty sure I am doing something wrong.
Not necessarily... Success depends on how the object itself is implemented. COM objects can be implemented as "early bound", where the types and methods are known at compile time, or "late bound", where the types and methods can all be determined at run-time, or both. PythonCom only works with object that support late binding. Have you tried running "makepy" on the ProvideX type library? If you're running Pythonwin, makepy is on the tools menu. > Any help would be greatly appreciated. The VB code is: > > ---------------------------------------------------- > Set oScript = CreateObject ("ProvideX.Script") > oScript.Init("C:\\Program Files\\Sage Software\\MAS > 90\\Version4\\MAS90\\Home") > > ' Set the user for the Session > Set oSS = oScript.NewObject("SY_Session") > r = oSS.nLogon() > If r=0 Then > ' Please remember to replace the usercode, password with valid info > r = oss.nSetUser("xxx","xxx") > End If > ----------------------------------------------------- > > There is more code then that, but I can't even get that far in the > Python code. You don't show how the objects are declared. If you have Dim oSS as Object then it's probably using late binding, and you should be able to make it work in Python. If it says: Dim oSS As ProvideX.IPvxDispatch or something similarly specific, then it may be using early binding. > Even though the dir(oSS) command shows that list, when I type oSS. in > the interactive window, the popup of options lists more options, as > does the COM browser. Well, the interactive browser learns gets its list of suggestions partially from the code you have previously executed. When you type oSS.nLogon, it's going to remember that as a suggestion for later. There also may be a method/property confusion, but I don't remember how to deal with that, but I'm sure Mark will reply. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32