Runtime error 0x800401F0 when running from standalone .exe
See original GitHub issueCurrently, using pyinstaller to build a onedir installation for my application that is using soundcard.
It all starts fine after adding the .h files but when I click my start recording button it throws a runtime error.
File "lib\site-packages\soundcard\mediafoundation.py", line 145, in get_microp hone
File "lib\site-packages\soundcard\mediafoundation.py", line 127, in all_microp hones
File "lib\site-packages\soundcard\mediafoundation.py", line 198, in __init__ File "lib\site-
packages\soundcard\mediafoundation.py", line 89, in check_error RuntimeError: Error 0x800401f0
--
It is something about the coInitialize but it sure looks like it actually gets set when I place a simple print at the line that does
hr = _combase.CoInitializeEx(_ffi.NULL, COINIT_MULTITHREADED)
This error doesn’t get thrown when running it as a python script it only happens when I run it from my standalone executable.
PS - Really amazing library that you build and a life saver
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Error 0x800401f0 when you update RemoteApp and Desktop ...
Fixes an issue in which RemoteApp and Desktop Connections feeds cannot be updated automatically. This issue occurs after update 2857650 is installed in ......
Read more >Runtime error when calling a .exe made with PyInstaller ...
The command: pyinstaller my_script.py runs fine without any errors. The problem occurs when I run the .exe file. Error:.
Read more >LabVIEW Standalone Executable Not Executing as Expected
I built a LabVIEW application and the behavior is not the same as in the development environment. The executable does not show any...
Read more >Unhandled exception error when running exe with tidal agent.
Hi all, I have an executable running on a windows 2008 server with a tidal ... Runtime.InteropServices.COMException (0x800401F0): Retrieving the COM class ...
Read more >Runtime error in compiled standalone - MATLAB Answers
I am doing it using deploytool, the problem is, when i run the final app, a black window comes and sunddenly disappears with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Alright, so I got it working the issue was that I am running the sound card library in a different thread that actually initialized it. So I needed to initialize the combase again inside the new thread.
I am using pywin32 for it with
pythoncom.CoInitialize()
It seems to work flawlessly now
Thank you!
Are you importing anything else besides SoundCard?
CoInitializeEx
can cause problems if other libraries are also interacting with ComBase. PyQt or PySide for example. I know that in PySide’s case, the issue goes away if you switch the import order between PySide and SoundCard.It might be that we would have to check if ComBase is already initialized, and only initialize if it isn’t… or something like that. SoundCard was my first foray into Windows programming, and I am far from an expert.