https://bugs.winehq.org/show_bug.cgi?id=44960
Bug ID: 44960 Summary: Unable to use python WMI winmgmts object Product: Wine Version: 3.5 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: wmi&wbemprox Assignee: wine-bugs@winehq.org Reporter: 20917771@student.uwa.edu.au Distribution: ---
Created attachment 61068 --> https://bugs.winehq.org/attachment.cgi?id=61068 A minimal test case
I am trying to use pywin32 to wait on an external process using its PID. I used winetricks WMI. I am using Ubuntu 16.04 LTS with Wine 3.5. I have attached a minimal example of the Python script. I expect it to wait for the other process to complete. Instead, I get the following output and the process exits immediately:
0009:fixme:kerberos:kerberos_SpInstanceInit 65536,0x7e0413a0,(nil): stub 0033:fixme:kerberos:kerberos_SpInstanceInit 65536,0x7e0913a0,(nil): stub 0009:err:ole:apartment_getclassobject DllGetClassObject returned error 0x80004002 for dll L"C:\windows\system32\wbem\wbemdisp.dll" 0009:err:ole:create_server class {172bddf8-ceea-11d1-8b05-00600806d9b6} not registered 0009:fixme:ole:CoGetClassObject CLSCTX_REMOTE_SERVER not supported 0009:err:ole:CoGetClassObject no class object {172bddf8-ceea-11d1-8b05-00600806d9b6} could be created for context 0x15 0009:err:ole:create_server class {8bc3f05e-d86b-11d0-a075-00c04fb68820} not registered 0009:fixme:ole:CoGetClassObject CLSCTX_REMOTE_SERVER not supported 0009:err:ole:CoGetClassObject no class object {8bc3f05e-d86b-11d0-a075-00c04fb68820} could be created for context 0x14 Traceback (most recent call last): File "test.py", line 10, in <module> wmi = win32com.client.GetObject('winmgmts:') File "C:\Python27\lib\site-packages\win32com\client__init__.py", line 72, in GetObject return Moniker(Pathname, clsctx) File "C:\Python27\lib\site-packages\win32com\client__init__.py", line 87, in Moniker moniker, i, bindCtx = pythoncom.MkParseDisplayName(Pathname) pywintypes.com_error: (-2147221164, 'REGDB_E_CLASSNOTREG', None, None)
https://bugs.winehq.org/show_bug.cgi?id=44960
Harry Small 20917771@student.uwa.edu.au changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #61068|bug.py |test.py filename| |
https://bugs.winehq.org/show_bug.cgi?id=44960
Harry Small 20917771@student.uwa.edu.au changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Unable to use python WMI |Unable to use WMI winmgmts |winmgmts object |object from Python
https://bugs.winehq.org/show_bug.cgi?id=44960
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal
--- Comment #1 from Hans Leidekker hans@meelstraat.net --- (In reply to Harry Small from comment #0)
Created attachment 61068 [details] A minimal test case
I am trying to use pywin32 to wait on an external process using its PID. I used winetricks WMI. I am using Ubuntu 16.04 LTS with Wine 3.5. I have attached a minimal example of the Python script. I expect it to wait for the other process to complete. Instead, I get the following output and the process exits immediately:
Native WMI is unlikely to ever work on Wine. What happens when you use builtin WMI? Can you attach a +wbemprox,+seh trace starting from a fresh prefix?
https://bugs.winehq.org/show_bug.cgi?id=44960
--- Comment #2 from Harry Small 20917771@student.uwa.edu.au --- Created attachment 61069 --> https://bugs.winehq.org/attachment.cgi?id=61069 trace
https://bugs.winehq.org/show_bug.cgi?id=44960
--- Comment #3 from Hans Leidekker hans@meelstraat.net --- (In reply to Harry Small from comment #2)
0009:trace:wbemprox:wbem_services_ExecQuery 0x1624b8, L"WQL", L"Select * from win32process where ParentProcessId=49", 0x00000010, (nil), 0x41f7b8 0009:trace:wbemprox:parse_query wql_parse returned 0 0009:trace:wbemprox:EnumWbemClassObject_create 0x41f7b8 0009:trace:wbemprox:EnumWbemClassObject_create returning iface 0x1b5a60 0009:trace:wbemprox:enum_class_object_Skip 0x1b5a60, -1, 1 0009:trace:wbemprox:enum_class_object_Reset 0x1b5a60 Traceback (most recent call last): File "test.py", line 16, in <module> retcode = proc.wait() AttributeError: 'NoneType' object has no attribute 'wait'
Looks like the query didn't yield any results, but I would have expected the trace to show that. Can you please attach a compiled (.exe) version of test.py?
https://bugs.winehq.org/show_bug.cgi?id=44960
--- Comment #4 from Harry Small 20917771@student.uwa.edu.au --- Find a compiled version here
https://www.dropbox.com/s/xmgsf5uif48df8w/test.exe?dl=0
https://bugs.winehq.org/show_bug.cgi?id=44960
--- Comment #5 from Hans Leidekker hans@meelstraat.net --- (In reply to Harry Small from comment #4)
Find a compiled version here
Thanks. That still needs a Python interpreter, which I had hoped to avoid. But I managed to set up Python 3.6.5 and ran 'wine python.exe test.py' from the python installation directory:
0009:trace:wbemprox:wbem_services_ExecQuery 0x138090, L"WQL", L"Select * from win32_process where ParentProcessId=45", 0x00000010, (nil), 0x41f73c 0009:trace:wbemprox:grab_table returning 0x7d4f65b0 0009:trace:wbemprox:parse_query wql_parse returned 0 0009:trace:wbemprox:fill_process created 1 rows
So it succeeds here. What command did you use to run the test?
https://bugs.winehq.org/show_bug.cgi?id=44960
--- Comment #6 from Harry Small 20917771@student.uwa.edu.au --- I am using Python 2.7 and pywin32 installed via PIP. Pyinstaller should have bundled the python interpreter for you, not sure why it did not work. The command is as you said: wine python.exe test.py
https://bugs.winehq.org/show_bug.cgi?id=44960
--- Comment #7 from Hans Leidekker hans@meelstraat.net --- (In reply to Harry Small from comment #6)
I am using Python 2.7 and pywin32 installed via PIP. Pyinstaller should have bundled the python interpreter for you, not sure why it did not work. The command is as you said: wine python.exe test.py
It appears to use to bundled interpreter for the initial invocation of test.py, but when the script itself invokes 'python test.py' the interpreter cannot be found.
Can you try running it from the python installation directory like I did? Copy test.py there and cd into that directory. If that still fails, please add +process to the trace flags and attach a new trace:
$ WINEDEBUG=+process,+wbemprox wine python.exe test.py &> trace.txt
https://bugs.winehq.org/show_bug.cgi?id=44960
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |WORKSFORME Keywords| |download, source
--- Comment #8 from Gijs Vermeulen gijsvrm@gmail.com --- I have the same result as Hans with wine-8.20. I tested with Python-2.7.
No response in over 5 years and since it works for me & Hans, resolving WORKSFORME.
Please reopen if you can still reproduce.
https://bugs.winehq.org/show_bug.cgi?id=44960
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Austin English austinenglish@gmail.com --- Closing.