pythonnet/pythonnet

From: https://mail.python.org/pipermail/pythondotnet/2015-August/001678.html

I may have found a bug in how the clr package converts .net exceptions to Python exceptions, at least as it relates to PyQt. If I try and add a library which does not exist, and then try and print the exception, PyQt is
subsequently unable to initialize OLE. This means that PyQt applications cannot use copy/paste and drag-and-drop.

Here is a minimal example:

import clr
import sys
from PyQt4 import QtGui

try:
    clr.AddReference('foo') #This doesn't exist
except Exception as e:
    print e
app = QtGui.QApplication(sys.argv)
app.exec_()

This results in the Qt error:

Qt: Could not initialize OLE (error 80010106)

The program runs, but copy/paste and drag-and-drop fails. If I do not try and print the exception (replace the except block with 'pass'), the program runs without any problems. Also, if the library exists I have no problems.