Note that there are some explanatory texts on larger screens.

plurals
  1. POConsuming Python COM Server from .NET
    primarykey
    data
    text
    <p>I wanted to implement python com server using win32com extensions. Then consume the server from within the .NET. I used the following example to implement the com server and it runs without a problem but when I try to consume it using C# I got FileNotFoundException with the following message "Retrieving the COM class factory for component with CLSID {676E38A6-7FA7-4BFF-9179-AE959734DEBB} failed due to the following error: 8007007e." . I posted the C# code as well.I wonder if I'm missing something I would appreciate any help.</p> <p>Thanks, Sarah </p> <pre><code>#PythonCOMServer.py import pythoncom class PythonUtilities: _public_methods_ = [ 'SplitString' ] _reg_progid_ = "PythonDemos.Utilities" # NEVER copy the following ID # Use"print pythoncom.CreateGuid()" to make a new one. _reg_clsid_ = pythoncom.CreateGuid() print _reg_clsid_ def SplitString(self, val, item=None): import string if item != None: item = str(item) return string.split(str(val), item) # Add code so that when this script is run by # Python.exe,.it self-registers. if __name__=='__main__': print 'Registering Com Server' import win32com.server.register win32com.server.register.UseCommandLine(PythonUtilities) // the C# code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Type pythonServer; object pythonObject; pythonServer = Type.GetTypeFromProgID("PythonDemos.Utilities"); pythonObject = Activator.CreateInstance(pythonServer); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload