OpenOPC Python Client on Linux

  • Markus

    Markus - 2011-11-15


    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?


  • SpinelliCreations

    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. 

  • Barry Barnreiter

    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.

  • Daniel Alvarez

    Daniel Alvarez - 2015-04-27


    I recently found OPenOPC and have begun building a project.
    my server has been installed, and tested out fine, it is WinXP
    I have now begun building out the client on Linux Ubuntu and have encountered
    this error in the PyCharm- ide.
    Has anyone encountered this error (below) while trying to connected to the server

    Current Script:


    import OpenOPC
    opc = OpenOPC.open_client('')


    Traceback (most recent call last):
    File "/home/dalvarez/PycharmProjects/TrainProj/", line 30, in <module>
    opc = OpenOPC.open_client('')
    File "/usr/lib/python2.7/", line 129, in open_client
    return server_obj.create_client()
    File "/usr/lib/pymodules/python2.7/Pyro/", line 381, in call
    return self.send(, args, kwargs)
    File "/usr/lib/pymodules/python2.7/Pyro/", line 455, in _invokePYRO
    File "/usr/lib/pymodules/python2.7/Pyro/", line 290, in bindToURI
    raise ProtocolError('connection failed')
    Pyro.errors.ProtocolError: connection failed

    Any advise would be very appreciated.

  • Ivan

    Ivan - 2016-02-12

    I resolved this problem by uninstalling python 2.7 (which was installed only for the user profile) and re-installing it for all users.


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