Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

COM servers

SkepsisSkepsis Posts: 9Member
Hi again.
Hope Im not boring you. I have moved on to COM servers and clients - thanks for the threading info.

I have succeeded in getting the example Server and a Client to work and even attached to a MS SQL database and used that, even on a remote server!

Pyhton is just SO GOOD !

but, and only a small but.
The client will only attach to the COM server in pythonwin and only after the COM browser has been run otherwise it comes up with the following error...

Traceback (most recent call last):
File "G:PYTHONl~ ~inframeworkscriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "G:PythonprogsCOMclient_1.py", line 2, in ?
o = win32com.client.Dispatch("Python.TestServer")
AttributeError: 'module' object has no attribute 'client'
the client is only 3 lines long

import win32com
o = win32com.client.Dispatch("Python.TestServer")
print o.Hello("Ade")

The server is the HelloWorld prog from the 'Quick Start to Server side COM and Python' program.

Also the same error is had when the client is run from the command line.
Even if an instance is made with something like OLe explorer or COM explorer.
Q. Does the 'Server' have to be invoked to run, in the programming of the client? If so why ( if not to technical) cos other COM objects just run, like the microsoft word or excel ones ( different kettle of Fish though)

I finally got to buy some books on Python but no help there on this one and many hours on the web has got me this far

Comments

  • infidelinfidel Posts: 2,900Member
    : but, and only a small but.
    : The client will only attach to the COM server in pythonwin and only after the COM browser has been run otherwise it comes up with the following error...
    :
    : Traceback (most recent call last):
    : File "G:PYTHONl~ ~inframeworkscriptutils.py", line 310, in RunScript
    : exec codeObject in __main__.__dict__
    : File "G:PythonprogsCOMclient_1.py", line 2, in ?
    : o = win32com.client.Dispatch("Python.TestServer")
    : AttributeError: 'module' object has no attribute 'client'
    : the client is only 3 lines long
    :
    : import win32com
    : o = win32com.client.Dispatch("Python.TestServer")
    : print o.Hello("Ade")

    client is a module itself, not an attribute (like a function or class) of win32com. Try "import win32com.client". Let me know if you still have any problems.


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

  • SkepsisSkepsis Posts: 9Member

    : client is a module itself, not an attribute (like a function or class) of win32com. Try "import win32com.client". Let me know if you still have any problems.
    :
    :
    : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    :
    :
    Once again, you solved it.
    Thanks
Sign In or Register to comment.