Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in version 2.3.0 - "Qt: Could not initialize OLE (error 80010106)" #439

Closed
christopherpow opened this issue Mar 23, 2017 · 15 comments
Closed

Comments

@christopherpow
Copy link
Contributor

Environment

  • Pythonnet version: 2.3.0
  • Python version: 2.7.13
  • Operating System: win7-32

Details

  • Describe what you were trying to get done.

    Upgrading to latest pythonnet. I have PyQt4 and Python27 working together with pythonnet 2.2.2.

  • What commands did you run to trigger this issue? If you can provide a

pip uninstall pythonnet
pip install pythonnet

@den-run-ai
Copy link
Contributor

Minimal reproducible code sample?

@vmuriart
Copy link
Contributor

I dont remember changing anything that would affect the thread initialization.

http://stackoverflow.com/questions/11708497/com-library-initilization-failed-with-code-0x80010106-in-c-sharp

An example would be great to figure out when/how this was introduced.

@vmuriart
Copy link
Contributor

Though, bug might have been present before from #127

@den-run-ai
Copy link
Contributor

@den-run-ai
Copy link
Contributor

@christopherpow if you add these lines before all clr and qt imports - no more OLE error !

import pythoncom
pythoncom.CoInitialize()
import clr
import sys
from PyQt4 import QtGui

I used the suggestion from here:

https://mail.python.org/pipermail/pythondotnet/2008-January/000761.html

@vmuriart
Copy link
Contributor

curious that the behavior changed though between 2.2.2 and 2.3.0

@den-run-ai
Copy link
Contributor

I just tried and I'm getting the same OLE error with 2.2.2 and 2.3.0 without pythoncom

@vmuriart
Copy link
Contributor

Most likely this is the same issue as #127. Something else changed and is causing the error that is being manifested as the ole error. something changed between 2.2.2 and 2.3.0 that is causing the exception in #127 that is then manifesting as the ole error. Without a full example we can't really troubleshoot.

@den-run-ai
Copy link
Contributor

@vmuriart I did not understand your last comment.

@vmuriart
Copy link
Contributor

import clr
"""some code"""
from PyQt4 import QtGui

The code sample above used to work on pythonnet 2.2.2 but something in 2.3.0 changed that makes some code throw an exception in 2.3.0 that in turn causes the com error to occur. Your suggestion above patches the PyQt4 issue, but the underlying cause isn't fixed. ie, what changed on some code that causes the error to happen.

Without more details from @christopherpow we can't figure it out though. PyQt4 failing is a symptom of the issue, but the code right before it is probably what we actually care about.

@christopherpow
Copy link
Contributor Author

I will try to get a minimal example tomorrow. Had to keep moving forward today.

@vmuriart
Copy link
Contributor

no worries. Thanks for taking the time and letting us know about it 👍

@den-run-ai
Copy link
Contributor

@vmuriart @filmor do you think it is possible to allow initializing CLR from Python under STA COM threading state without using pythoncom:

ctypes.windll.ole32.CoInitialize

https://msdn.microsoft.com/en-us/library/system.stathreadattribute%28v=vs.110%29.aspx

@filmor
Copy link
Member

filmor commented Jul 11, 2017

@christopherpow Did you manage to build a minimal example?

@den-run-ai
Copy link
Contributor

closing as reasonable workarounds are provided

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants