OpenOPC Python Client on Linux

  • Markus


    I'm trying to install and use OpenOPC with Python on Debian.
    Maybe I'm doing something wrong. I get always the following error:

    Traceback (most recent call last):
      File "", line 2, in <module>
        opc = OpenOPC.client()
      File "/home/gorgemann/OpenOPC-1.1.6/src/", line 167, in __init__
        except pythoncom.com_error, err:
    NameError: global name 'pythoncom' is not defined

    pythoncom isn't available for Debian.
    Any idea what I can do?


  • sir, the code chunk where line 167 results in an exception is calling "win32com.client.gencache.EnsureDispatch(c, 0)".

    as you can see… there's a direct reference to the the "win32com.client" library, which is a WINDOWS ONLY library for python.

    from the looks of it, that is the section which lists the available opc class (server types) on the machine via os-specific defined environment variables.

    long story short - that 'chunk' of code should never be run on a linux box. 

    the open opc gateway service should be run on a windows server (or a virtual machine inside a linux host), and the open opc client can then 'talk' to the gateway from the linux world. 

  • On Linux you should be doing this….

    opc = OpenOPC.open_client(host)

    Where "host" is the name or IP address of your box running the OpenOPC Gateway Service.

    As Vince said, OpenOPC.client() should never be called on a non-Windows box.