Python COM Class Question

P

pemo

I'm trying to use difflib.py from a COM aware language - and, for ease of
use, I'm initially trying to get this going from VB6.

I've wrappered difflib.py correctly I think, and I can now call into it and
call a global method (called 'test' of course). Here's the consuming code:

Dim PythonUtils As Object

Set PythonUtils = CreateObject("DiffLib.Utils")

Debug.Print PythonUtils.test()

However, difflib contains classes - like SequenceMatcher, and I've no idea
how to get an instance of these from PythonUtils.

Can someone help me here please?

Thanks

pemo
 
S

Steve Holden

pemo said:
I'm trying to use difflib.py from a COM aware language - and, for ease of
use, I'm initially trying to get this going from VB6.

I've wrappered difflib.py correctly I think, and I can now call into it and
call a global method (called 'test' of course). Here's the consuming code:

Dim PythonUtils As Object

Set PythonUtils = CreateObject("DiffLib.Utils")

Debug.Print PythonUtils.test()

However, difflib contains classes - like SequenceMatcher, and I've no idea
how to get an instance of these from PythonUtils.

Can someone help me here please?
I hope so.

You need to wrap the Python objects for use in the COM framework - once
wrapped their methods can be called by the client code.

You'll find wrap in win32com.server.util.

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,222
Messages
2,571,140
Members
47,755
Latest member
Grazynkaa

Latest Threads

Top