invalid class string

  • Fabrizio

    Fabrizio - 2011-09-02

    Hello everyone,

    I tried to run OpenOPC with the current Python 3.2 and I realized it does not work.

    Now I installed the old Python 2.6.6 and it also does not work, it gives me an "invalid class string" from line 170.

    I also tried to run opc.exe from the windows console but I get the error "Failed to initialized an OPC automation class  from the search list '…' - Dispatch: invalid class string"

    Does anyone know what the problem could be?

    I use windows xp and installed the pywin32 package.

    Thank you!

  • SpinelliCreations

    Have you installed Pyro (python remote objects) ?

  • Fabrizio

    Fabrizio - 2011-09-02

    Hello and thanks for the quick reply!

    I just installed Pyro but the it did not solve the issue.

    I have a feeling that some of the required dlls are missing or corrupted, as I first installed python32, then 27 and finally 26. It might be a big mess on my disk. What paths do I need to set in order for the correct dlls to be accessed? Also, is it enough to just paste the in the python folder or do I need something else?

    Thank you!

  • SpinelliCreations

    depends on how you're trying to use it - if you are just running the gateway service and then running the executable (precompiled) then you don't even need python.  if you're running your own programs that access the openopc library (, then you'll need to have (i believe) a 2.5 / 2.6 / 2.7 python installed - plus pyro - and have in the same folder as your own program ( and in same folder).

  • Fabrizio

    Fabrizio - 2011-09-05

    The gateway service, that's what I was missing! I did not install it before running the OpenOPC…
    Sorry I wasted your time, I feel dumb. Thanks for the great help!

  • SpinelliCreations

    No sweat buddy - I feel dumb every day - it's usually just before something awesome happens…

  • Dundo

    Dundo - 2013-11-12


    I'm having a problem with OpenOPC in DCOM mode.

    I would like to connect to a local OPC server (Matrikon simulation server) from my Python program but I'm getting "OpenOPC.OPCError: Dispatch: Invalid class string"

    Line that triggers this exception is "opc = OpenOPC.client()" and are in the source folder and OpenOPC is imported.

    It's interesting that with opc.exe I see Matrikon.OPC.Simulation server and can read tag values but " -q" returns:

    "Failed to initialize an OPC Automation Class from the search list 'Matrikon.OPC.Automation;Graybox.OPC.DAWrapper;HSCOPC.Automation;RSI.OPCAutomation;OPC.Automation' - Dispatch: Invalid class string"

    What am I missing?


    OS: Windows 7 x64
    Python: 2.7.5 64bit
    OpenOPC: 1.2.0
    Matrikon.OPC.Simulation: 1.5
    Pyro: 3.16
    OPC Core components & SDK: v2 and v3

    • AlbertZ

      AlbertZ - 2014-03-13

      Hi, I got the same problem just like yours, have you solved that? how?

      • SpinelliCreations

        I just ran into this last week, and resolved it.

        -- OpenOPC cannot find the Automation DLL (there are several it checks for, one from Rockwell, one from Kepware, one from Matrikon, Honeywell, Yokigowa, and the generic GrayBox Wrapper.) If it can't find any - it throws that fault.

        In my case, it was because I was using 64 bit Python with 32-bit OPC Servers and a 32 bit Automation DLL.

        Now, if you've got a 64 bit OPC Server, then Graybox has released a 64 bit version of the DLL, which you can get here... - move it to c:\windows\system32\ and run c:> c:\windows\system32\regsvr32.exe grayboxwrapperdllfilename - and use 64 bit Python.

        However, if you're in a mixed environment, then the 32-bit wrapper from the same download will work - move it to c:\windows\syswow64\ and run c:> c:\windows\syswow64\regsvr32.exe grayboxwrapperdllfilename - and use 32 bit Python.

        • AlbertZ

          AlbertZ - 2015-08-05

          It's worked! thank you.
          I was too busy that time, and did not reply your comment.
          thanks again.

      • Dundo

        Dundo - 2014-07-07


        I don't remember how and if I have resolved it.

        I'm using the OpenOPC mode and it works great. OpenOPC service needs to be installed and started on the server machine.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks